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

The following examples show how to use com.esotericsoftware.kryo.io.Output#writeFloat() . 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: FloatOperand.java    From ytk-mp4j with MIT License 6 votes vote down vote up
public void write(Kryo kryo, Output output, MapMetaData<Float> object) {
    try {
        List<Map<String, Float>> mapDataList = mapMetaData.getMapDataList();
        mapMetaData.send(output);
        int mapSegNum = mapMetaData.getSegNum();
        for (int i = 0; i < mapSegNum; i++) {
            Map<String, Float> mapData = mapDataList.get(i);
            for (Map.Entry<String, Float> entry : mapData.entrySet()) {
                output.writeString(entry.getKey());
                output.writeFloat(entry.getValue());
            }
            if (mapMetaData.getCollective() == Collective.GATHER ||
                    mapMetaData.getCollective() == Collective.SCATTER ||
                    mapMetaData.getCollective() == Collective.REDUCE_SCATTER) {
                mapData.clear();
            }
        }

    } catch (IOException e) {
        LOG.error("double array write exception", e);
        System.exit(1);
    }
}
 
Example 2
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 3
Source File: FloatOperand.java    From ytk-mp4j with MIT License 6 votes vote down vote up
public void write(Kryo kryo, Output output, ArrayMetaData<float[]> object) {
    try {
        float[] 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.writeFloat(arrData[j]);
            }
        }
    } catch (IOException e) {
        LOG.error("double array write exception", e);
        System.exit(1);
    }
}
 
Example 4
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, Interpolation.Swing object) {
	try {
		output.writeFloat(field.getFloat(object));
	} catch (IllegalAccessException e) {
		throw new RuntimeException(e);
	}
}
 
Example 5
Source File: IntHistogram.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(cdfFractions.length);
    for ( final float val : cdfFractions ) {
        output.writeFloat(val);
    }
    output.writeLong(nCounts);
}
 
Example 6
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 7
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, Interpolation.SwingOut object) {
	try {
		output.writeFloat(field.getFloat(object));
	} catch (IllegalAccessException e) {
		throw new RuntimeException(e);
	}
}
 
Example 8
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, Interpolation.SwingIn object) {
	try {
		output.writeFloat(field.getFloat(object));
	} catch (IllegalAccessException e) {
		throw new RuntimeException(e);
	}
}
 
Example 9
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, Interpolation.ElasticOut object) {
	output.writeFloat(object.value);
	output.writeFloat(object.power);
	output.writeFloat(abs(object.scale / MathUtils.PI));
	output.writeFloat(object.bounces);
}
 
Example 10
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, Interpolation.ElasticIn object) {
	output.writeFloat(object.value);
	output.writeFloat(object.power);
	output.writeFloat(abs(object.scale / MathUtils.PI));
	output.writeFloat(object.bounces);
}
 
Example 11
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, Interpolation.Elastic object) {
	output.writeFloat(object.value);
	output.writeFloat(object.power);
	output.writeFloat(abs(object.scale / MathUtils.PI));
	output.writeFloat(object.bounces);
}
 
Example 12
Source File: WeightApproximateQuantile.java    From ytk-learn with MIT License 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, Summary object) {
    output.writeInt(object.value.length);
    for (int i = 0; i < object.value.length; i++) {
        output.writeFloat(object.value[i]);
    }

    output.writeInt(object.rmin.length);
    for (int i = 0; i < object.rmin.length; i++) {
        output.writeDouble(object.rmin[i]);
    }

    output.writeInt(object.rmax.length);
    for (int i = 0; i < object.rmax.length; i++) {
        output.writeDouble(object.rmax[i]);
    }

    output.writeInt(object.w.length);
    for (int i = 0; i < object.w.length; i++) {
        output.writeFloat(object.w[i]);
    }

    output.writeInt(object.capacity);
    output.writeInt(object.cursor);
    output.writeDouble(object.B);
    output.writeBoolean(object.exact);
    output.writeDouble(object.eps);
}
 
Example 13
Source File: SplitInfo.java    From ytk-learn with MIT License 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, SplitInfo object) {
    output.writeFloat(object.lossChg);
    output.writeInt(object.splitIndex);
    output.writeFloat(object.splitValue);
    output.writeInt(object.splitSlotInterval.length);
    for (int i = 0; i < object.splitSlotInterval.length; i++) {
        output.writeInt(object.splitSlotInterval[i]);
    }
}
 
Example 14
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, Interpolation.ExpOut object) {
	output.writeFloat(object.value);
	output.writeFloat(object.power);
}
 
Example 15
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, Interpolation.ExpIn object) {
	output.writeFloat(object.value);
	output.writeFloat(object.power);
}
 
Example 16
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, TriangularFloatDistribution object) {
	output.writeFloat(object.getLow());
	output.writeFloat(object.getHigh());
	output.writeFloat(object.getMode());
}
 
Example 17
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, Interpolation.Exp object) {
	output.writeFloat(object.value);
	output.writeFloat(object.power);
}
 
Example 18
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, UniformFloatDistribution object) {
	output.writeFloat(object.getLow());
	output.writeFloat(object.getHigh());
}
 
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, ConstantFloatDistribution object) {
	output.writeFloat(object.getValue());
}
 
Example 20
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, TriangularIntegerDistribution object) {
	output.writeInt(object.getLow());
	output.writeInt(object.getHigh());
	output.writeFloat(object.getMode());
}