Java Code Examples for com.esotericsoftware.kryo.io.Input#readShort()

The following examples show how to use com.esotericsoftware.kryo.io.Input#readShort() . 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 ArrayMetaData<short[]> read(Kryo kryo, Input input, Class<ArrayMetaData<short[]>> type) {
    try {
        short[] arrData = arrayMetaData.getArrData();
        thatArrMetaData = arrayMetaData.recv(input);
        int arrSegNum = thatArrMetaData.getSegNum();
        for (int i = 0; i < arrSegNum; i++) {
            int from = thatArrMetaData.getFrom(i);
            int to = thatArrMetaData.getTo(i);
            for (int j = from; j < to; j++) {
                arrData[j] = input.readShort();
            }
        }
        thatArrMetaData.setArrData(arrData);
    } catch (IOException e) {
        LOG.error("double array read exception", e);
        System.exit(1);
    }
    return thatArrMetaData;

}
 
Example 2
Source File: ShortOperand.java    From ytk-mp4j with MIT License 6 votes vote down vote up
@Override
public MapMetaData<Short> read(Kryo kryo, Input input, Class<MapMetaData<Short>> type) {
    try {
        thatMapMetaData = mapMetaData.recv(input);
        int thatMapSegNum = thatMapMetaData.getSegNum();
        List<Map<String, Short>> mapDataList = new ArrayList<>(thatMapSegNum);
        thatMapMetaData.setMapDataList(mapDataList);

        for (int i = 0; i < thatMapSegNum; i++) {
            int dataNum = thatMapMetaData.getDataNum(i);
            Map<String, Short> mapData = new HashMap<>(dataNum);
            mapDataList.add(mapData);
            for (int j = 0; j < dataNum; j++) {
                String key = input.readString();
                Short val = input.readShort();
                mapData.put(key, val);
            }
        }
    } catch (IOException e) {
        LOG.error("double array read exception", e);
        System.exit(1);
    }
    return thatMapMetaData;
}
 
Example 3
Source File: Pair.java    From gatk with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private Pair(Kryo kryo, Input input){
    super(input.readInt(true), input.readString());

    // Information used to detect optical dupes
    tile = -1;
    x = -1;
    y = -1;
    libraryId = -1;

    score = input.readShort();

    isRead1ReverseStrand = input.readBoolean();

    isRead2ReverseStrand = input.readBoolean();

    readGroupIndex = input.readShort();
    wasFlipped = input.readBoolean();
}
 
Example 4
Source File: ShortOperand.java    From ytk-mp4j with MIT License 5 votes vote down vote up
public MapMetaData<Short> read(Kryo kryo, Input input, Class<MapMetaData<Short>> type) {
    try {
        thatMapMetaData = mapMetaData.recv(input);
        int thatMapSegNum = thatMapMetaData.getSegNum();
        List<Map<String, Short>> thatMapListData = new ArrayList<>(thatMapSegNum);
        List<Integer> thatDataNums = new ArrayList<>(thatMapSegNum);
        for (int i = 0; i < thatMapSegNum; i++) {
            Map<String, Short> thisMapData = mapMetaData.getMapDataList().get(i);
            int dataNum = thatMapMetaData.getDataNum(i);
            for (int j = 0; j < dataNum; j++) {
                String key = input.readString();
                Short val = input.readShort();

                Short thisVal = thisMapData.get(key);
                if (thisVal == null) {
                    thisMapData.put(key, val);
                } else {
                    thisMapData.put(key, operator.apply(thisVal, val));
                }
            }
            thatMapListData.add(thisMapData);
            thatDataNums.add(thisMapData.size());
        }

        thatMapMetaData.setMapDataList(thatMapListData);
        thatMapMetaData.setDataNums(thatDataNums);

    } catch (IOException e) {
        LOG.error("double array read exception", e);
        System.exit(1);
    }
    return thatMapMetaData;
}
 
Example 5
Source File: ConcatMap.java    From metron with Apache License 2.0 5 votes vote down vote up
@Override
public void read(Kryo kryo, Input input) {
  int numVariableMappings = input.readShort();
  variableMappings = new ArrayList<>(numVariableMappings);
  for(int i = 0;i < numVariableMappings;++i) {
    int size = input.readInt();
    if(size > 0) {
      byte[] bytes = input.readBytes(size);
      Map m = SerDeUtils.fromBytes(bytes, Map.class);
      variableMappings.add(m);
    }
  }
}
 
Example 6
Source File: UserIdSerializer.java    From gameserver with Apache License 2.0 5 votes vote down vote up
@Override
public UserId read(Kryo kryo, Input input, Class type) {
	int length = input.readShort();
	byte[] array = new byte[length];
	input.readBytes(array);
	return UserId.fromBytes(array);
}
 
Example 7
Source File: PyLongSerializer.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public PyLong read(Kryo kryo, Input input, Class<PyLong> type) {
	int length = input.readShort();
	return new PyLong(new BigInteger(input.readBytes(length)));
}
 
Example 8
Source File: DefaultApplicationIdSerializer.java    From onos with Apache License 2.0 4 votes vote down vote up
@Override
public DefaultApplicationId read(Kryo kryo, Input input, Class<DefaultApplicationId> type) {
    short id = input.readShort();
    String name = input.readString();
    return new DefaultApplicationId(id, name);
}