private ushort ReadUInt16()
{
// Get the first byte, which contains the length, and boundary check
int firstByte = this.innerStream.ReadByte();
if (firstByte == -1) return 0;
// Get the second byte, which contains the length, and boundary check
int secondByte = this.innerStream.ReadByte();
if (secondByte == -1) return 0;
// Convert the bytes to the 16-bit unsigned integer
ushort result = (ushort)firstByte;
result += (ushort)(secondByte * 256);
return result;
}