ReadUInt8() public static method

Read a byte from a stream and advances the position within the stream by 1.
public static ReadUInt8 ( Stream stream ) : byte
stream Stream The stream.
return byte
Ejemplo n.º 1
0
        /// <summary>
        /// Deserialize fields in this class from a stream.
        /// </summary>
        /// <param name="stream">Stream contains a serialized instance of this class.</param>
        /// <param name="size">How many bytes can read if -1, no limitation. MUST be -1.</param>
        /// <returns>Bytes have been read from the stream.</returns>
        public override int Deserialize(Stream stream, int size)
        {
            AdapterHelper.Site.Assert.AreEqual(-1, size, "The size value MUST be -1, the actual value is {0}.", size);

            int bytesRead = 0;

            this.xidSize = StreamHelper.ReadUInt8(stream);
            bytesRead   += 1;
            this.xid     = new XID();
            bytesRead   += this.xid.Deserialize(stream, (int)this.xidSize);
            return(bytesRead);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Reads a byte from the stream.
 /// </summary>
 /// <returns>A byte value read from the stream.</returns>
 private byte ReadByte()
 {
     return(StreamHelper.ReadUInt8(this.stream));
 }