buf_stream_reader
This struct provides a buffered access to a Read object
with a limited Seek implementation.
Seeking is limited by the following constraints:
- Only a small bunch of bytes is buffered (defined by the
buffer_sizeparameter of [BufStreamReader::new()]) - We don't know the end of the stream, using
SeekFrom::Endis not supported - Seeking backward is allowed only if the targeted position is within the current buffer.
Seeking backward as possible as far as there are data in the current buffer
use ;
use BufStreamReader;
let cursor = new; // points to array with values from \x00 .. \xff
let mut reader = new.unwrap;
let mut buffer: = ;
/* straightly reading 7 bytes works */
assert_eq!;
assert_eq!;
/* seeking backwards inside the current buffer */
assert!;
assert_eq!;
assert_eq!;
Seeking backwards is not possible if the destination is not within of behind the current buffer
let cursor = new; // points to array with values from \x00 .. \xff
let mut reader = new.unwrap;
let mut buffer: = ;
assert!;
assert!;
assert!;
Seeking forward is not limited, as well as reading beyond buffer limits (as far as data is available, of course)
let cursor = new; // points to array with values from \x00 .. \xff
let mut reader = new.unwrap;
let mut buffer: = ;
assert!;
assert_eq!;
assert_eq!;
assert!;
assert_eq!;
assert_eq!;