public override StreamElement Deserialize(StreamElement reuse, IDataInputView source) { int tag = source.ReadByte(); if (tag == TagRecWithTimestamp) { var timestamp = source.ReadLong(); var value = ContainedTypeSerializer.Deserialize(source); var reuseRecord = reuse.AsRecord <T>(); reuseRecord.Replace(value, timestamp); return(reuseRecord); } else if (tag == TagRecWithoutTimestamp) { var value = ContainedTypeSerializer.Deserialize(source); var reuseRecord = reuse.AsRecord <T>(); reuseRecord.Replace(value); return(reuseRecord); } else if (tag == TagWatermark) { return(new Watermark(source.ReadLong())); } else if (tag == TagLatencyMarker) { return(new LatencyMarker(source.ReadLong(), new OperatorId(source.ReadLong(), source.ReadLong()), source.ReadInt())); } else { throw new IOException("Corrupt stream, found tag: " + tag); } }
public override StreamElement Deserialize(IDataInputView source) { int tag = source.ReadByte(); if (tag == TagRecWithTimestamp) { var timestamp = source.ReadLong(); return(new StreamRecord <T>(ContainedTypeSerializer.Deserialize(source), timestamp)); } else if (tag == TagRecWithoutTimestamp) { return(new StreamRecord <T>(ContainedTypeSerializer.Deserialize(source))); } else if (tag == TagWatermark) { return(new Watermark(source.ReadLong())); } else if (tag == TagStreamStatus) { return(new StreamStatus(source.ReadInt())); } else if (tag == TagLatencyMarker) { return(new LatencyMarker(source.ReadLong(), new OperatorId(source.ReadLong(), source.ReadLong()), source.ReadInt())); } else { throw new IOException("Corrupt stream, found tag: " + tag); } }
public override int CompareSerialized(IDataInputView firstSource, IDataInputView secondSource) { var b1 = firstSource.ReadByte(); var b2 = secondSource.ReadByte(); var comp = (b1 < b2 ? -1 : (b1 == b2 ? 0 : 1)); return(AscendingComparison ? comp : -comp); }
public override byte Deserialize(IDataInputView source) => source.ReadByte();
public override void Copy(IDataInputView source, IDataOutputView target) => target.WriteByte(source.ReadByte());