RiakClient.Erlang.OtpInputStream.Read1 C# (CSharp) Method

Read1() public method

Read one byte from the stream.
public Read1 ( ) : byte
return byte
        public byte Read1()
        {
            int i = ReadByte();
            if (i < 0)
            {
                throw new Exception("Cannot read from input stream");
            }

            return (byte)i;
        }

Usage Example

 public void Can_Peek(byte[] buf, bool want)
 {
     using (var s = new OtpInputStream(buf))
     {
         byte b = s.Read1();
         Assert.AreEqual(OtpExternal.VersionTag, b);
         b = s.Peek();
         Assert.AreEqual(OtpExternal.AtomTag, b);
         string atom = s.ReadAtom();
         Assert.AreEqual(want.ToString().ToLowerInvariant(), atom); 
     }
 }