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

ReadN() public method

Read an array of bytes from the stream into the buffer. The method reads at most buffer.Length bytes from the input stream.
public ReadN ( byte buffer ) : int
buffer byte The buffer into which to read data.
return int
        public int ReadN(byte[] buffer)
        {
            return ReadN(buffer, 0, buffer.Length);
        }

Same methods

OtpInputStream::ReadN ( byte buffer, int offset, int count ) : int

Usage Example

 public void Read_Zero_Throws_At_End()
 {
     byte[] inbuf = { 0, 1, 2, 3 };
     byte[] outbuf = new byte[1];
     using (var s = new OtpInputStream(inbuf))
     {
         s.ReadN(outbuf);
         s.ReadN(outbuf);
         s.ReadN(outbuf);
         s.ReadN(outbuf);
         Assert.Throws(typeof(Exception), () => s.ReadN(outbuf, 0, 0));
     }
 }