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

The following examples show how to use com.esotericsoftware.kryo.io.Input#readString() . 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: BreakpointComplications.java    From gatk with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
SmallDuplicationBreakpointComplications(final Kryo kryo, final Input input) {
    super(kryo, input);
    final String ctg = input.readString();
    final int start = input.readInt();
    final int end = input.readInt();
    dupSeqRepeatUnitRefSpan = new SimpleInterval(ctg, start, end);
    dupSeqRepeatNumOnRef = input.readInt();
    dupSeqRepeatNumOnCtg = input.readInt();
    dupSeqStrandOnRef = new ArrayList<>(dupSeqRepeatNumOnRef);
    for (int i=0; i<dupSeqRepeatNumOnRef; ++i) {
        dupSeqStrandOnRef.add(Strand.values()[input.readInt()]);
    }
    dupSeqStrandOnCtg = new ArrayList<>(dupSeqRepeatNumOnCtg);
    for (int i=0; i<dupSeqRepeatNumOnCtg; ++i) {
        dupSeqStrandOnCtg.add(Strand.values()[input.readInt()]);
    }
}
 
Example 2
Source File: DoubleOperand.java    From ytk-mp4j with MIT License 6 votes vote down vote up
@Override
public MapMetaData<Double> read(Kryo kryo, Input input, Class<MapMetaData<Double>> type) {
    try {
        thatMapMetaData = mapMetaData.recv(input);
        int thatMapSegNum = thatMapMetaData.getSegNum();
        List<Map<String, Double>> mapDataList = new ArrayList<>(thatMapSegNum);
        thatMapMetaData.setMapDataList(mapDataList);

        for (int i = 0; i < thatMapSegNum; i++) {
            int dataNum = thatMapMetaData.getDataNum(i);
            Map<String, Double> mapData = new HashMap<>(dataNum);
            mapDataList.add(mapData);
            for (int j = 0; j < dataNum; j++) {
                String key = input.readString();
                Double val = input.readDouble();
                mapData.put(key, val);
            }
        }
    } catch (IOException e) {
        LOG.error("double array read exception", e);
        System.exit(1);
    }
    return thatMapMetaData;
}
 
Example 3
Source File: StreamingContainerManager.java    From attic-apex-core with Apache License 2.0 6 votes vote down vote up
@Override
public void read(final Object object, final Input in) throws KryoException
{
  final StreamingContainerManager scm = (StreamingContainerManager)object;

  final String operatorName = in.readString();
  final String propertyName = in.readString();
  final String propertyValue = in.readString();

  final OperatorMeta logicalOperator = scm.plan.getLogicalPlan().getOperatorMeta(operatorName);
  if (logicalOperator == null) {
    throw new IllegalArgumentException("Unknown operator " + operatorName);
  }

  scm.setOperatorProperty(logicalOperator, propertyName, propertyValue);
}
 
Example 4
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 5
Source File: StreamingContainerManager.java    From Bats with Apache License 2.0 6 votes vote down vote up
@Override
public void read(final Object object, final Input in) throws KryoException
{
  final StreamingContainerManager scm = (StreamingContainerManager)object;

  final String operatorName = in.readString();
  final String propertyName = in.readString();
  final String propertyValue = in.readString();

  final OperatorMeta logicalOperator = scm.plan.getLogicalPlan().getOperatorMeta(operatorName);
  if (logicalOperator == null) {
    throw new IllegalArgumentException("Unknown operator " + operatorName);
  }

  scm.setOperatorProperty(logicalOperator, propertyName, propertyValue);
}
 
Example 6
Source File: EventSerializer.java    From flowmix with Apache License 2.0 6 votes vote down vote up
@Override
public Event read(Kryo kryo, Input input, Class<Event> eventClass) {
    String uuid = input.readString();
    long timestamp = input.readLong();

    Event event = new BaseEvent(uuid, timestamp);
    int numTuples = input.readInt();
    for(int i = 0; i < numTuples; i++) {

        String key = input.readString();
        String alias = input.readString();
        String val = input.readString();

        event.put(new Tuple(key, registry.decode(alias, val)));
    }

    return event;

}
 
Example 7
Source File: IpAddress.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
public void read(Kryo kryo, Input input) {
    readMetadata(kryo, input);
    String ipAddressString = input.readString();
    setValue(ipAddressString);
    setNormalizedValue(ipAddressString);
    validate();
}
 
Example 8
Source File: VideoChunkSerializer.java    From StormCV with Apache License 2.0 5 votes vote down vote up
@Override
protected VideoChunk readObject(Kryo kryo, Input input, Class<VideoChunk> clas, long requestId, String streamId, long sequenceNr) throws Exception {
	long duration = input.readLong();
	int length = input.readInt();
	byte[] video = input.readBytes(length);
	String container = input.readString();
	VideoChunk chunk = new VideoChunk(streamId, sequenceNr, duration, video, container);
	chunk.setRequestId(requestId);
	return chunk;
}
 
Example 9
Source File: AvroKryoSerializerUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Schema read(Kryo kryo, Input input, Class<Schema> type) {
	String schemaAsString = input.readString();
	// the parser seems to be stateful, to we need a new one for every type.
	Schema.Parser sParser = new Schema.Parser();
	return sParser.parse(schemaAsString);
}
 
Example 10
Source File: ByteOperand.java    From ytk-mp4j with MIT License 5 votes vote down vote up
public MapMetaData<Byte> read(Kryo kryo, Input input, Class<MapMetaData<Byte>> type) {
    try {
        thatMapMetaData = mapMetaData.recv(input);
        int thatMapSegNum = thatMapMetaData.getSegNum();
        List<Map<String, Byte>> thatMapListData = new ArrayList<>(thatMapSegNum);
        List<Integer> thatDataNums = new ArrayList<>(thatMapSegNum);
        for (int i = 0; i < thatMapSegNum; i++) {
            Map<String, Byte> thisMapData = mapMetaData.getMapDataList().get(i);
            int dataNum = thatMapMetaData.getDataNum(i);
            for (int j = 0; j < dataNum; j++) {
                String key = input.readString();
                Byte val = input.readByte();

                Byte 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 11
Source File: NovelAdjacencyAndAltHaplotype.java    From gatk with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected NovelAdjacencyAndAltHaplotype(final Kryo kryo, final Input input) {
    final String contig1 = input.readString();
    final int start1 = input.readInt();
    final int end1 = input.readInt();
    this.leftJustifiedLeftRefLoc = new SimpleInterval(contig1, start1, end1);
    final String contig2 = input.readString();
    final int start2 = input.readInt();
    final int end2 = input.readInt();
    this.leftJustifiedRightRefLoc = new SimpleInterval(contig2, start2, end2);

    this.strandSwitch = StrandSwitch.values()[input.readInt()];

    this.complication = (BreakpointComplications) kryo.readClassAndObject(input);

    this.type = TypeInferredFromSimpleChimera.values()[ input.readInt() ];

    final boolean altSeqIsNull = input.readBoolean();
    if (altSeqIsNull) {
        altHaplotypeSequence = null;
    } else {
        final int arraySize = input.readInt();
        altHaplotypeSequence = new byte[arraySize];
        for (int i = 0 ; i < arraySize; ++i) {
            altHaplotypeSequence[i] = input.readByte();
        }
    }
}
 
Example 12
Source File: AvroKryoSerializerUtils.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public Schema read(Kryo kryo, Input input, Class<Schema> type) {
	String schemaAsString = input.readString();
	// the parser seems to be stateful, to we need a new one for every type.
	Schema.Parser sParser = new Schema.Parser();
	return sParser.parse(schemaAsString);
}
 
Example 13
Source File: TradeCustomerSerializer.java    From jstorm with Apache License 2.0 5 votes vote down vote up
@Override
public TradeCustomer read(Kryo kryo, Input input, Class<TradeCustomer> arg2) {

    Pair custormer = kryo.readObject(input, Pair.class);
    Pair trade = kryo.readObject(input, Pair.class);

    long timeStamp = input.readLong();
    String buffer = input.readString();

    TradeCustomer inner = new TradeCustomer(timeStamp, trade, custormer, buffer);
    return inner;
}
 
Example 14
Source File: AlignmentInterval.java    From gatk with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
AlignmentInterval(final Kryo kryo, final Input input) {
    final String chr = input.readString();
    final int refStart = input.readInt(),
            refEnd = input.readInt();
    referenceSpan = new SimpleInterval(chr, refStart, refEnd);
    startInAssembledContig = input.readInt();
    endInAssembledContig = input.readInt();
    cigarAlong5to3DirectionOfContig = TextCigarCodec.decode(input.readString());
    forwardStrand = input.readBoolean();
    mapQual = input.readInt();
    mismatches = input.readInt();
    alnScore = input.readInt();
    alnModType = ContigAlignmentsModifier.AlnModType.values()[input.readInt()];
}
 
Example 15
Source File: ProviderIdSerializer.java    From onos with Apache License 2.0 5 votes vote down vote up
@Override
public ProviderId read(Kryo kryo, Input input, Class<ProviderId> type) {
    String scheme = input.readString();
    String id = input.readString();
    boolean isAncillary = input.readBoolean();
    return new ProviderId(scheme, id, isAncillary);
}
 
Example 16
Source File: GeoPoint.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
public void read(Kryo kryo, Input input) {
    readMetadata(kryo, input);
    
    this.point = input.readString();
    validate();
}
 
Example 17
Source File: StreamingContainerManager.java    From Bats with Apache License 2.0 5 votes vote down vote up
@Override
public void read(final Object object, final Input in) throws KryoException
{
  final StreamingContainerManager scm = (StreamingContainerManager)object;

  final int operatorId = in.readInt();
  final String propertyName = in.readString();
  final String propertyValue = in.readString();

  final PTOperator o = scm.plan.getAllOperators().get(operatorId);
  if (o == null) {
    throw new IllegalArgumentException("Unknown physical operator " + operatorId);
  }
  scm.setPhysicalOperatorProperty(o, propertyName, propertyValue);
}
 
Example 18
Source File: Serializer.java    From Overchan-Android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public File read (Kryo kryo, Input input, Class<File> type) {
    return new File(input.readString());
}
 
Example 19
Source File: KryoPojosForMigrationTests.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Dog read(Kryo kryo, Input input, Class<Dog> type) {
	return new Dog(input.readString());
}
 
Example 20
Source File: AddressSerializer.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public Address read(Kryo kryo, Input input, Class<Address> type) {
  String host = input.readString();
  int port = input.readInt();
  return Address.from(host, port);
}