Fan.Sys.InStream.readBufFully C# (CSharp) Method

readBufFully() public method

public readBufFully ( Buf buf, long n ) : Buf
buf Buf
n long
return Buf
        public virtual Buf readBufFully(Buf buf, long n)
        {
            if (buf == null) buf = Buf.make(n);

              long total = n;
              long got = 0;
              while (got < total)
              {
            Long r = readBuf(buf, total-got);
            if (r == null || r.longValue() == 0) throw IOErr.make("Unexpected end of stream").val;
            got += r.longValue();
              }

              buf.flip();
              return buf;
        }