Ejemplo n.º 1
0
        public void Copy(IDataInputView source, IDataOutputView target)
        {
            var len = source.ReadUnsignedByte();

            target.WriteByte(len);

            if (len >= HighBit)
            {
                var shift = 7;
                int curr;
                len = len & 0x7f;
                while ((curr = source.ReadUnsignedByte()) >= HighBit)
                {
                    len   |= (curr & 0x7f) << shift;
                    shift += 7;
                    target.WriteByte(curr);
                }
                len |= curr << shift;
                target.WriteByte(curr);
            }

            for (var i = 0; i < len; i++)
            {
                var c = source.ReadUnsignedByte();
                target.WriteByte(c);
                while (c >= HighBit)
                {
                    c = source.ReadUnsignedByte();
                    target.WriteByte(c);
                }
            }
        }
Ejemplo n.º 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);
        }
        public override void Serialize(short[] record, IDataOutputView target)
        {
            if (record == null)
            {
                throw new IllegalArgumentException("The record must not be null.");
            }

            var len = record.Length;

            target.WriteShort(len);
            for (var i = 0; i < len; i++)
            {
                target.WriteShort(record[i]);
            }
        }
        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();
            }
        }
Ejemplo n.º 5
0
 public override void Serialize(string record, IDataOutputView target)
 {
     throw new NotImplementedException();
 }
 public override void Serialize(byte record, IDataOutputView target) => target.WriteByte(record);
Ejemplo n.º 7
0
 public override void Write(IDataOutputView output)
 {
     // Nothing to do here
 }
Ejemplo n.º 8
0
 public void Write(IDataOutputView output)
 {
     throw new System.NotImplementedException();
 }
 public override void Copy(IDataInputView source, IDataOutputView target)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 10
0
 public override void Copy(IDataInputView source, IDataOutputView target) => target.WriteInt(source.ReadInt());
 public override void WriteWithKeyNormalization(TElement[] record, IDataOutputView target) => throw new UnSupportedOperationException();
Ejemplo n.º 12
0
 public override void Serialize(float record, IDataOutputView target) => target.WriteFloat(record);
 public override void Serialize(short record, IDataOutputView target) => target.WriteShort(record);
Ejemplo n.º 14
0
 public abstract void Write(IDataOutputView output);
 public override void Serialize(long record, IDataOutputView target) => target.WriteLong(record);
Ejemplo n.º 16
0
 /// <summary>
 /// Writes the record in such a fashion that all keys are normalizing and at the beginning of the serialized data.
 /// This must only be used when for all the key fields the full normalized key is used.
 /// </summary>
 /// <param name="record">The record object into which to read the record data.</param>
 /// <param name="target">The stream to which to write the data,</param>
 public abstract void WriteWithKeyNormalization(T record, IDataOutputView target);
 /// <summary>
 /// Serializes the given record to the given target output view.
 /// </summary>
 /// <param name="record">The record to serialize.</param>
 /// <param name="target">The output view to write the serialized data to</param>
 public abstract void Serialize(T record, IDataOutputView target);
Ejemplo n.º 18
0
 /// <summary>
 /// Copies exactly one record from the source input view to the target output view. Whether this operation works on binary data or partially de-serializes the record to determine its length (such as for records of variable length) is up to the implementer. Binary copies are typically faster.
 /// </summary>
 /// <param name="source">The input view from which to read the record.</param>
 /// <param name="target">The target output view to which to write the record.</param>
 /// <exception cref="IOException">Thrown if any of the two views raises an exception.</exception>
 public abstract void Copy(IDataInputView source, IDataOutputView target);
Ejemplo n.º 19
0
 public override void Serialize(double record, IDataOutputView target) => target.WriteDouble(record);
 public override void Serialize(DateTime record, IDataOutputView target) => target.WriteLong(record.Ticks);
Ejemplo n.º 21
0
 public override void Serialize(bool record, IDataOutputView target) => target.WriteBool(record);
Ejemplo n.º 22
0
 public override void WriteWithKeyNormalization(T record, IDataOutputView target) => throw new InvalidOperationException();
Ejemplo n.º 23
0
 public override void Serialize(int record, IDataOutputView target) => target.WriteInt(record);
Ejemplo n.º 24
0
 public override void Write(IDataOutputView output)
 => throw new UnSupportedOperationException("This method should never be called");
 public override void Serialize(VoidNamespace record, IDataOutputView target)
 {
     throw new System.NotImplementedException();
 }
 public override void Serialize(char record, IDataOutputView target) => target.WriteChar(record);
Ejemplo n.º 27
0
 public void WriteSnapshot(IDataOutputView output)
 {
 }
Ejemplo n.º 28
0
 public override void Serialize(IDictionary <TKey, TValue> record, IDataOutputView target)
 {
     throw new NotImplementedException();
 }