Java Code Examples for com.esotericsoftware.kryo.io.Output#writeLong()

The following examples show how to use com.esotericsoftware.kryo.io.Output#writeLong() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LongOperand.java    From ytk-mp4j with MIT License 6 votes vote down vote up
public void write(Kryo kryo, Output output, ArrayMetaData<long[]> object) {
    try {
        long[] arrData = arrayMetaData.getArrData();
        arrayMetaData.send(output);
        int arrSegNum = arrayMetaData.getSegNum();
        for (int i = 0; i < arrSegNum; i++) {
            int from = arrayMetaData.getFrom(i);
            int to = arrayMetaData.getTo(i);
            for (int j = from; j < to; j++) {
                output.writeLong(arrData[j]);
            }
        }
    } catch (IOException e) {
        LOG.error("double array write exception", e);
        System.exit(1);
    }
}
 
Example 2
Source File: EventSerializer.java    From flowmix with Apache License 2.0 6 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, Event event) {

    try {
        output.writeString(event.getId());
        output.writeLong(event.getTimestamp());
        output.writeInt(event.getTuples().size());
        for(Tuple tupleSet : event.getTuples()) {
            output.writeString(tupleSet.getKey());
            output.writeString(registry.getAlias(tupleSet.getValue()));
            output.writeString(registry.encode(tupleSet.getValue()));
        }

    } catch(Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example 3
Source File: HBaseElementSerializer.java    From hgraphdb with Apache License 2.0 6 votes vote down vote up
public void write(Kryo kryo, Output output, E element) {
    byte[] idBytes = ValueUtils.serialize(element.id());
    output.writeInt(idBytes.length);
    output.writeBytes(idBytes);
    output.writeString(element.label());
    output.writeLong(element.createdAt());
    output.writeLong(element.updatedAt());
    Map<String, Object> properties = element.getProperties();
    output.writeInt(properties.size());
    properties.forEach((key, value) -> {
        output.writeString(key);
        byte[] bytes = ValueUtils.serialize(value);
        output.writeInt(bytes.length);
        output.writeBytes(bytes);
    });
}
 
Example 4
Source File: OnlineStatisticsProvider.java    From metron with Apache License 2.0 6 votes vote down vote up
@Override
public void write(Kryo kryo, Output output) {
  //storing tdigest
  ByteBuffer outBuffer = ByteBuffer.allocate(digest.byteSize());
  digest.asBytes(outBuffer);
  byte[] tdigestSerialized = outBuffer.array();
  output.writeInt(tdigestSerialized.length);
  output.writeBytes(tdigestSerialized);
  output.writeLong(n);
  output.writeDouble(sum);
  output.writeDouble(sumOfSquares);
  output.writeDouble(sumOfLogs);
  output.writeDouble(getMin());
  output.writeDouble(getMax());
  output.writeDouble(M1);
  output.writeDouble(M2);
  output.writeDouble(M3);
  output.writeDouble(M4);
}
 
Example 5
Source File: FrameSerializer.java    From StormCV with Apache License 2.0 6 votes vote down vote up
@Override
protected void writeObject(Kryo kryo, Output output, Frame frame) throws IOException{
	output.writeLong(frame.getTimestamp());
	output.writeString(frame.getImageType());
	byte[] buffer = frame.getImageBytes();
	if(buffer != null){
		output.writeInt(buffer.length);
		output.writeBytes(buffer);
	}else{
		output.writeInt(0);
	}
	output.writeFloat((float)frame.getBoundingBox().getX());
	output.writeFloat((float)frame.getBoundingBox().getY());
	output.writeFloat((float)frame.getBoundingBox().getWidth());
	output.writeFloat((float)frame.getBoundingBox().getHeight());
	
	kryo.writeObject(output, frame.getFeatures());
}
 
Example 6
Source File: PSKmerBloomFilter.java    From gatk with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void serialize(final Kryo kryo, final Output output) {
    output.writeInt(kmerSize);
    output.writeLong(kmerMask.getLong());
    kryo.writeObject(output, kmerSet);
    output.writeDouble(falsePositiveProbability);
    output.close();
}
 
Example 7
Source File: CVParticleSerializer.java    From StormCV with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, Type type) {
	output.writeLong(type.getRequestId());
	output.writeString(type.getStreamId());
	output.writeLong(type.getSequenceNr());
	kryo.writeObject(output, type.getMetadata());
	try {
		this.writeObject(kryo, output, type);
	} catch (Exception e) {
		//TODO
	}
	output.flush();
	//output.close();
}
 
Example 8
Source File: DescriptorSerializer.java    From StormCV with Apache License 2.0 5 votes vote down vote up
@Override
protected void writeObject(Kryo kryo, Output output, Descriptor descriptor) {
	output.writeFloat((float)descriptor.getBoundingBox().getX());
	output.writeFloat((float)descriptor.getBoundingBox().getY());
	output.writeFloat((float)descriptor.getBoundingBox().getWidth());
	output.writeFloat((float)descriptor.getBoundingBox().getHeight());
	
	output.writeLong(descriptor.getDuration());
	
	output.writeInt(descriptor.getValues().length);
	for(Float f : descriptor.getValues()){
		output.writeFloat(f);
	}
}
 
Example 9
Source File: VideoChunkSerializer.java    From StormCV with Apache License 2.0 5 votes vote down vote up
@Override
protected void writeObject(Kryo kryo, Output output, VideoChunk video) throws Exception {
	output.writeLong(video.getDuration());
	output.writeInt(video.getVideo().length);
	output.writeBytes(video.getVideo());
	output.writeString(video.getContainer());
}
 
Example 10
Source File: AttributeContentEvent.java    From incubator-samoa with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, AttributeContentEvent event) {
  output.writeLong(event.learningNodeId, true);
  output.writeInt(event.obsIndex, true);
  output.writeDouble(event.attrVal, PRECISION, true);
  output.writeInt(event.classVal, true);
  output.writeDouble(event.weight, PRECISION, true);
  output.writeBoolean(event.isNominal);
}
 
Example 11
Source File: DefaultPortSerializer.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, DefaultPort object) {
    kryo.writeClassAndObject(output, object.element());
    kryo.writeObject(output, object.number());
    output.writeBoolean(object.isEnabled());
    kryo.writeObject(output, object.type());
    output.writeLong(object.portSpeed());
    kryo.writeClassAndObject(output, object.annotations());
}
 
Example 12
Source File: RegisterTypeWithKryoSerializerITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, TestClass testClass) {
	output.writeLong(42);
}
 
Example 13
Source File: RegisterTypeWithKryoSerializerITCase.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, TestClass testClass) {
	output.writeLong(42);
}
 
Example 14
Source File: KryoUtils.java    From gdx-ai with Apache License 2.0 4 votes vote down vote up
@Override
public void write (Kryo kryo, Output output, ConstantLongDistribution object) {
	output.writeLong(object.getValue());
}
 
Example 15
Source File: TimeWindowSerde.java    From attic-apex-malhar with Apache License 2.0 4 votes vote down vote up
@Override
public void serialize(TimeWindow timeWindow, Output output)
{
  output.writeLong(timeWindow.getBeginTimestamp());
  output.writeLong(timeWindow.getDurationMillis());
}
 
Example 16
Source File: MastershipBasedTimestampSerializer.java    From onos with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, MastershipBasedTimestamp object) {
    output.writeLong(object.termNumber());
    output.writeLong(object.sequenceNumber());
}
 
Example 17
Source File: PSKmerSet.java    From gatk with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void serialize(final Kryo kryo, final Output output) {
    output.writeInt(kmerSize);
    output.writeLong(kmerMask.getLong());
    kryo.writeObject(output, kmerSet);
    output.close();
}
 
Example 18
Source File: SVKmerShort.java    From gatk with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void serialize(final Kryo kryo, final Output output) {
    output.writeLong(valLow);
}
 
Example 19
Source File: KryoUtils.java    From gdx-ai with Apache License 2.0 4 votes vote down vote up
@Override
public void write (Kryo kryo, Output output, UniformLongDistribution object) {
	output.writeLong(object.getLow());
	output.writeLong(object.getHigh());
}
 
Example 20
Source File: IntHistogram.java    From gatk with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void serialize( final Kryo kryo, final Output output ) {
    output.writeInt(counts.length);
    for ( final long val : counts ) {
        output.writeLong(val);
    }
}