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

The following examples show how to use com.esotericsoftware.kryo.io.Output#writeShort() . 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: ShortOperand.java    From ytk-mp4j with MIT License 6 votes vote down vote up
public void write(Kryo kryo, Output output, ArrayMetaData<short[]> object) {
    try {
        short[] 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.writeShort(arrData[j]);
            }
        }
    } catch (IOException e) {
        LOG.error("double array write exception", e);
        System.exit(1);
    }
}
 
Example 2
Source File: ShortOperand.java    From ytk-mp4j with MIT License 6 votes vote down vote up
public void write(Kryo kryo, Output output, MapMetaData<Short> object) {
    try {
        List<Map<String, Short>> mapDataList = mapMetaData.getMapDataList();
        mapMetaData.send(output);
        int mapSegNum = mapMetaData.getSegNum();
        for (int i = 0; i < mapSegNum; i++) {
            Map<String, Short> mapData = mapDataList.get(i);
            for (Map.Entry<String, Short> entry : mapData.entrySet()) {
                output.writeString(entry.getKey());
                output.writeShort(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 3
Source File: ConcatMap.java    From metron with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Kryo kryo, Output output) {
  int numVariableMappings = variableMappings.isEmpty()?0:variableMappings.size();
  output.writeShort(numVariableMappings);
  for(Map m : variableMappings) {
    byte[] b = m == null?new byte[]{}:SerDeUtils.toBytes(m);
    output.writeInt(b.length);
    if(b.length > 0) {
      output.writeBytes(b);
    }
  }
}
 
Example 4
Source File: PyLongSerializer.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, PyLong object) {
	byte[] data = object.getValue().toByteArray();
	output.writeShort(data.length);
	output.writeBytes(data);
}
 
Example 5
Source File: TinyColumn.java    From cubedb with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void write(Kryo kryo, Output output) {
  output.writeInt(this.data.size());
  output.writeInt(this.offset);
  for (int i = 0; i < this.data.size(); i++) output.writeShort(this.data.get(i));
}
 
Example 6
Source File: UserIdSerializer.java    From gameserver with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, UserId userId) {
	byte[] bytes = userId.getInternal();
	output.writeShort(bytes.length);
	output.write(bytes);
}
 
Example 7
Source File: DefaultApplicationIdSerializer.java    From onos with Apache License 2.0 4 votes vote down vote up
@Override
public void write(Kryo kryo, Output output, DefaultApplicationId object) {
    output.writeShort(object.id());
    output.writeString(object.name());
}
 
Example 8
Source File: Pair.java    From gatk with BSD 3-Clause "New" or "Revised" License 3 votes vote down vote up
protected void serialize(Kryo kryo, Output output) {
    output.writeInt(partitionIndex, true);
    output.writeAscii(name);

    output.writeShort(score);

    output.writeBoolean(isRead1ReverseStrand);

    output.writeBoolean(isRead2ReverseStrand);

    output.writeShort(readGroupIndex);
    output.writeBoolean(wasFlipped);
}