![]() |
Bitcoin Core 31.0.0
P2P Digital Currency
|
Wrapper around an AutoFile& that implements a ring buffer to deserialize from. More...
#include <streams.h>
Public Member Functions | |
| BufferedFile (AutoFile &file LIFETIMEBOUND, uint64_t nBufSize, uint64_t nRewindIn) | |
| bool | eof () const |
| check whether we're at the end of the source file | |
| void | read (std::span< std::byte > dst) |
| read a number of bytes | |
| void | SkipTo (const uint64_t file_pos) |
| uint64_t | GetPos () const |
| return the current reading position | |
| bool | SetPos (uint64_t nPos) |
| rewind to a given reading position | |
| bool | SetLimit (uint64_t nPos=std::numeric_limits< uint64_t >::max()) |
| template<typename T> | |
| BufferedFile & | operator>> (T &&obj) |
| void | FindByte (std::byte byte) |
| search for a given byte in the stream, and remain positioned on it | |
Private Member Functions | |
| bool | Fill () |
| read data from the source to fill the buffer | |
| std::pair< std::byte *, size_t > | AdvanceStream (size_t length) |
Private Attributes | |
| AutoFile & | m_src |
| uint64_t | nSrcPos {0} |
| how many bytes have been read from source | |
| uint64_t | m_read_pos {0} |
| how many bytes have been read from this | |
| uint64_t | nReadLimit |
| up to which position we're allowed to read | |
| uint64_t | nRewind |
| how many bytes we guarantee to rewind | |
| DataBuffer | vchBuf |
Wrapper around an AutoFile& that implements a ring buffer to deserialize from.
It guarantees the ability to rewind a given number of bytes.
Will automatically close the file when it goes out of scope if not null. If you need to close the file early, use file.fclose() instead of fclose(file).
|
inline |
|
inlineprivate |
Advance the stream's read pointer (m_read_pos) by up to 'length' bytes, filling the buffer from the file so that at least one byte is available. Return a pointer to the available buffer data and the number of bytes (which may be less than the requested length) that may be accessed beginning at that pointer.
Definition at line 514 of file streams.h.
|
inline |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |