generic<R: Reader> struct BufReader {
&R inner;
unsigned long pos;
unsigned long len;
unsigned char buf[IO_BUF_SIZE];
}Fields
the stream read from (borrowed)
next unread byte in buf
bytes in buf
Methods
Reader: at most n bytes, from the buffer first. A read of at least IO_BUF_SIZE bytes with nothing buffered goes straight to the stream. The count read, 0 at the stream's end, -1 on error.
Appends bytes to 'out' up to and including the first occurrence of 'term' (a non-empty string; "\n" reads a line, "\r\n\r\n" an HTTP header block). 1 when 'term' arrived; 0 when the stream ended or failed first ('out' then holds what did arrive). Bytes after 'term' stay buffered for the next read.
Bytes already read from the stream and not yet returned: a read of at most this many doesn't touch the stream.