Struct std::io::BufferedReader
struct BufferedReader<R> { ... }
R: Readable<R>
A buffered wrapper over an underlying stream.
Fields
Methods
impl BufferedReader<R> { ... }
R: Readable<R>
-
fn new(inner: &mut R, buf_size: usize) -> BufferedReader<R>
Create a BufferedReader with a heap-allocated buffer of the given size.
-
fn from_slice(inner: &mut R, buf: &mut [u8]) -> BufferedReader<R>
Creates a BufferedReader from an existing-buffer, potentially avoiding a heap allocation.
-
fn fill_buffer(self: &mut BufferedReader<R>) -> Result<&[u8]>
Return the current contents of the buffer, reading additional data from the stream if necessary.
Does not move the internal buffer position.
-
fn consume(self: &mut BufferedReader<R>, amount: usize)
Mark
amount
bytes as consumed, moving the internal buffer position forward. -
fn read(self: &mut BufferedReader<R>, buf: &mut [u8]) -> Result<usize>
Reads from the stream into a provided buffer.
If successful, returns the number of bytes read. This may be less than the size of the provided buffer.
-
fn read_exact(self: &mut BufferedReader<R>, buf: &mut [u8]) -> Result<()>
Fills the provided buffer by reading from the stream.
If stream had less bytes available than the size of the buffer, this method will return an
Error::eof()
. -
fn free(self: &mut BufferedReader<R>)
Frees the memory backing the object.
-
fn move(self: &mut BufferedReader<R>) -> BufferedReader<R>
impl BufferedReader<R> { ... }
R: Seekable<R>
-
fn seek(self: &mut BufferedReader<R>, whence: SeekFrom, offset: i64) -> Result<u64>
Jump to a specified position in the stream.
Returns the new position in the stream from the beginning.
Mixins
impl BufferedReader<R> { ... }
R: Readable<R>
-
mixin Readable<BufferedReader<R>>
-
Reads the entire stream into a
StringBuf
.If successful, returns the number of bytes that were read.
impl BufferedReader<R> { ... }
R: Seekable<R>
-
mixin Seekable<BufferedReader<R>>
-
Rewind the stream to the beginning.
-
Returns the current position in the stream from the beginning.