public override void Serialize(StreamElement value, IDataOutputView target)
        {
            if (value.IsRecord)
            {
                var record = value.AsRecord <T>();

                if (record.HasTimestamp)
                {
                    target.Write(TagRecWithTimestamp);
                    target.WriteLong(record.Timestamp);
                }
                else
                {
                    target.Write(TagRecWithoutTimestamp);
                }

                ContainedTypeSerializer.Serialize(record.Value, target);
            }
            else if (value.IsWatermark)
            {
                target.Write(TagWatermark);
                target.WriteLong(value.AsWatermark().Timestamp);
            }
            else if (value.IsStreamStatus)
            {
                target.Write(TagStreamStatus);
                target.WriteInt(value.AsStreamStatus().Status);
            }
            else if (value.IsLatencyMarker)
            {
                target.Write(TagLatencyMarker);
                target.WriteLong(value.AsLatencyMarker().MarkedTime);
                target.WriteLong(value.AsLatencyMarker().OperatorId.LowerPart);
                target.WriteLong(value.AsLatencyMarker().OperatorId.UpperPart);
                target.WriteInt(value.AsLatencyMarker().SubTaskIndex);
            }
            else
            {
                throw new RuntimeException();
            }
        }
예제 #2
0
        public override void Serialize(byte[] record, IDataOutputView target)
        {
            if (record == null)
            {
                throw new IllegalArgumentException("The record must not be null.");
            }

            var len = record.Length;

            target.WriteInt(len);
            target.Write(record);
        }