|
roo_io
API Documentation for roo_io
|
#include <buffered_input_stream_iterator.h>
Public Member Functions | |
| BufferedInputStreamIterator () | |
Creates a detached iterator with kClosed status. | |
| BufferedInputStreamIterator (roo_io::InputStream &input) | |
Creates iterator over input. | |
| BufferedInputStreamIterator (BufferedInputStreamIterator &&other) | |
| Move-constructs iterator state. | |
| BufferedInputStreamIterator & | operator= (BufferedInputStreamIterator &&other) |
| Move-assigns iterator state. | |
| byte | read () |
| Reads one byte. | |
| size_t | read (byte *buf, size_t count) |
Reads up to count bytes into buf. | |
| void | skip (size_t count) |
Skips up to count bytes. | |
| Status | status () const |
| Returns current iterator status. | |
| bool | ok () const |
Returns whether status() == kOk. | |
| bool | eos () const |
Returns whether status() == kEndOfStream. | |
| void | reset (roo_io::InputStream &input) |
Rebinds iterator to input and clears buffered state. | |
| void | reset () |
| Detaches from stream and releases internal buffer. | |
Definition at line 13 of file buffered_input_stream_iterator.h.
|
inline |
Creates a detached iterator with kClosed status.
Definition at line 16 of file buffered_input_stream_iterator.h.
|
inline |
Creates iterator over input.
Initializes status() from input.status(). Allocates internal buffer only when initial status is kOk.
Definition at line 27 of file buffered_input_stream_iterator.h.
References roo_io::kInputStreamIteratorBufferSize, and roo_io::kOk.
|
inline |
Move-constructs iterator state.
Source iterator becomes detached with kClosed status.
Definition at line 38 of file buffered_input_stream_iterator.h.
References roo_io::kClosed.
|
inline |
Returns whether status() == kEndOfStream.
true iff current status is kEndOfStream. Definition at line 170 of file buffered_input_stream_iterator.h.
References roo_io::kEndOfStream, and status().
|
inline |
Returns whether status() == kOk.
true iff current status is kOk. Definition at line 165 of file buffered_input_stream_iterator.h.
References roo_io::kOk, and status().
|
inline |
Move-assigns iterator state.
Source iterator becomes detached with kClosed status.
Definition at line 53 of file buffered_input_stream_iterator.h.
References roo_io::kClosed.
|
inline |
Reads one byte.
If buffered data is available, returns it without changing status(). If status() != kOk, returns zero byte and leaves status unchanged. Otherwise reads from underlying stream; when that read returns zero, updates status() from input.status().
Definition at line 76 of file buffered_input_stream_iterator.h.
References roo_io::kInputStreamIteratorBufferSize, roo_io::kOk, roo_io::InputStream::read(), and roo_io::InputStream::status().
Referenced by roo_io::InputStreamReader::read().
Reads up to count bytes into buf.
Uses buffered bytes first. If status() != kOk, returns zero and leaves status unchanged. When delegated stream read returns zero, updates status() from input.status().
Definition at line 100 of file buffered_input_stream_iterator.h.
References roo_io::count, roo_io::kInputStreamIteratorBufferSize, roo_io::kOk, roo_io::InputStream::read(), and roo_io::InputStream::status().
|
inline |
Detaches from stream and releases internal buffer.
Sets status to kClosed.
Definition at line 190 of file buffered_input_stream_iterator.h.
References roo_io::kClosed.
|
inline |
Rebinds iterator to input and clears buffered state.
Updates status() to input.status(). Allocates buffer lazily when needed and status is kOk.
Definition at line 176 of file buffered_input_stream_iterator.h.
References roo_io::kInputStreamIteratorBufferSize, and roo_io::kOk.
Referenced by roo_io::InputStreamReader::close(), roo_io::InputStreamReader::reset(), and roo_io::InputStreamReader::reset().
Skips up to count bytes.
If skip is satisfied from buffered bytes, status() is unchanged. Otherwise clears local buffer state and, when status() == kOk, delegates remaining skip to underlying stream and updates status() from input.status().
Definition at line 144 of file buffered_input_stream_iterator.h.
References roo_io::count, roo_io::kOk, roo_io::InputStream::skip(), and roo_io::InputStream::status().
Referenced by roo_io::InputStreamReader::skip().
|
inline |
Returns current iterator status.
Definition at line 160 of file buffered_input_stream_iterator.h.
Referenced by eos(), ok(), and roo_io::InputStreamReader::status().