Beispiel #1
0
        /// <summary>Read a UTF8 encoded string with a maximum size</summary>
        /// <exception cref="System.IO.IOException"/>
        public static string ReadString(BinaryReader reader, int maxLength)
        {
            int length = WritableUtils.ReadVIntInRange(@in, 0, maxLength);

            byte[] bytes = new byte[length];
            @in.ReadFully(bytes, 0, length);
            return(Decode(bytes));
        }
Beispiel #2
0
        /// <exception cref="System.IO.IOException"/>
        public virtual void ReadFields(BinaryReader reader)
        {
            keyId      = WritableUtils.ReadVInt(@in);
            expiryDate = WritableUtils.ReadVLong(@in);
            int len = WritableUtils.ReadVIntInRange(@in, -1, MaxKeyLen);

            if (len == -1)
            {
                keyBytes = null;
            }
            else
            {
                keyBytes = new byte[len];
                @in.ReadFully(keyBytes);
            }
        }
        /// <exception cref="System.IO.IOException"/>
        public override void ReadFields(DataInput @in)
        {
            this.cache  = null;
            expiryDate  = WritableUtils.ReadVLong(@in);
            keyId       = WritableUtils.ReadVInt(@in);
            userId      = WritableUtils.ReadString(@in);
            blockPoolId = WritableUtils.ReadString(@in);
            blockId     = WritableUtils.ReadVLong(@in);
            int length = WritableUtils.ReadVIntInRange(@in, 0, typeof(BlockTokenSecretManager.AccessMode
                                                                      ).GetEnumConstants().Length);

            for (int i = 0; i < length; i++)
            {
                modes.AddItem(WritableUtils.ReadEnum <BlockTokenSecretManager.AccessMode>(@in));
            }
        }