|
roo_io
API Documentation for roo_io
|
Virtualizes access to files, memory, and other readable sources. More...
#include <multipass_input_stream.h>
Public Member Functions | |
| virtual uint64_t | size ()=0 |
| Returns stream size in bytes from beginning. | |
| virtual uint64_t | position () const =0 |
| Returns current byte offset from beginning of stream. | |
| virtual void | rewind () |
| Resets stream to starting position. | |
| virtual void | seek (uint64_t offset)=0 |
| Seeks to byte offset from beginning. | |
Public Member Functions inherited from roo_io::InputStream | |
| virtual | ~InputStream () |
| virtual bool | isOpen () const |
| Returns whether stream is considered open. | |
| virtual void | close () |
| Closes this stream. | |
| virtual size_t | read (byte *result, size_t count)=0 |
Attempts to read up to count bytes into result. | |
| virtual size_t | tryRead (byte *result, size_t count) |
Attempts to read up to count bytes into result without indefinitely blocking. | |
| virtual size_t | readFully (byte *buf, size_t count) |
Attempts to read count bytes into buf; blocks as needed. | |
| virtual void | skip (uint64_t count) |
Skips over count bytes, updating status(). | |
| virtual Status | status () const =0 |
| Returns status of the most recent I/O operation. | |
Virtualizes access to files, memory, and other readable sources.
Represents an open resource with a seekable read cursor.
For iterator-style use, prefer BufferedMultipassInputStreamIterator to avoid virtual-call overhead per byte.
Definition at line 15 of file multipass_input_stream.h.
Returns current byte offset from beginning of stream.
If status is neither kOk nor kEndOfStream, return value is unspecified.
Implemented in roo_io::NullInputStream, and roo_io::MemoryInputStream< PtrType >.
Referenced by roo_io::BufferedMultipassInputStreamIterator::position(), roo_io::BufferedMultipassInputStreamIterator::rewind(), and roo_io::BufferedMultipassInputStreamIterator::seek().
Resets stream to starting position.
Updates status.
If pre-call status is neither kOk nor kEndOfStream, status is unchanged.
On success, status becomes kOk (clearing EOS if present) and position() becomes 0.
Definition at line 42 of file multipass_input_stream.h.
References seek().
Referenced by roo_io::BufferedMultipassInputStreamIterator::rewind().
Seeks to byte offset from beginning.
Offset may be greater than current size().
If pre-call status is neither kOk nor kEndOfStream, status is unchanged.
On success, status becomes kOk and position() equals offset. On error, status updates accordingly.
Implemented in roo_io::NullInputStream, and roo_io::MemoryInputStream< PtrType >.
Referenced by rewind(), and roo_io::BufferedMultipassInputStreamIterator::seek().
Returns stream size in bytes from beginning.
Value may differ across calls when underlying source mutates.
If pre-call status is neither kOk nor kEndOfStream, status is unchanged and return value is 0.
On error, status updates accordingly and return value is 0.
Implemented in roo_io::NullInputStream, and roo_io::MemoryInputStream< PtrType >.
Referenced by roo_io::BufferedMultipassInputStreamIterator::size().