Exemplo n.º 1
0
        public override byte[] Encode(ScalarValue value_Renamed)
        {
            byte[] bytes      = value_Renamed.Bytes;
            int    lengthSize = IntegerCodec.GetUnsignedIntegerSize(bytes.Length);
            var    encoding   = new byte[bytes.Length + lengthSize];

            byte[] length = UINT.Encode(new IntegerValue(bytes.Length));
            Array.Copy(length, 0, encoding, 0, lengthSize);
            Array.Copy(bytes, 0, encoding, lengthSize, bytes.Length);
            return(encoding);
        }
Exemplo n.º 2
0
        public override byte[] EncodeValue(ScalarValue value_Renamed)
        {
            if (value_Renamed.Null)
            {
                return(NULLABLE_UNSIGNED_INTEGER.EncodeValue(ScalarValue.NULL));
            }
            var byteVectorValue = (ByteVectorValue)value_Renamed;
            int lengthSize      = IntegerCodec.GetUnsignedIntegerSize(byteVectorValue.value_Renamed.Length);
            var encoding        = new byte[byteVectorValue.value_Renamed.Length + lengthSize];

            byte[] length = NULLABLE_UNSIGNED_INTEGER.Encode(new IntegerValue(byteVectorValue.value_Renamed.Length));
            Array.Copy(length, 0, encoding, 0, lengthSize);
            Array.Copy(byteVectorValue.value_Renamed, 0, encoding, lengthSize, byteVectorValue.value_Renamed.Length);
            return(encoding);
        }