public override int[] Deserialize(IDataInputView source) { var len = source.ReadInt(); var result = new int[len]; for (var i = 0; i < len; i++) { result[i] = source.ReadInt(); } return(result); }
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 i1 = firstSource.ReadInt(); var i2 = secondSource.ReadInt(); var comp = (i1 < i2 ? -1 : (i1 == i2 ? 0 : 1)); return(AscendingComparison ? comp : -comp); }
public override byte[] Deserialize(IDataInputView source) { var len = source.ReadInt(); var result = new byte[len]; source.ReadFully(result); return(result); }
public override int CompareSerialized(IDataInputView firstSource, IDataInputView secondSource) { var firstCount = firstSource.ReadInt(); var secondCount = secondSource.ReadInt(); for (var x = 0; x < Math.Min(firstCount, secondCount); x++) { var result = Comparator.CompareSerialized(firstSource, secondSource); if (result != 0) { return(result); } } var cmp = firstCount - secondCount; return(Ascending ? cmp : -cmp); }
public override int Deserialize(IDataInputView source) => source.ReadInt();
public override void Copy(IDataInputView source, IDataOutputView target) => target.WriteInt(source.ReadInt());
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); } }