|
CeresEngine 0.2.0
A game development framework
|
A filtered InputStream that caches read and write operations to it's underlying InputStream.
More...
#include <CeresEngine/Foundation/IO/Stream.Buffered.hpp>
Public Member Functions | |
| BufferedInputStream (InputStream &&inputStream, size_t bufferSize=1024) | |
| Creates a new buffer data stream. | |
| BufferedInputStream (const BufferedInputStream &)=delete | |
| BufferedInputStream (BufferedInputStream &&) noexcept | |
| ~BufferedInputStream () final | |
| Destroys the buffered data stream. | |
| void | seek (std::streamsize position, Seek mode=Seek::Start) final |
| Changes the position of the data stream. | |
| size_t | tell () final |
| Gets the absolute stream position, in bytes. | |
| size_t | read (void *data, size_t n) final |
Reads data from the data stream to a buffer of raw memory data with length n. | |
| bool | invalidate () final |
| In the stream is buffered, invalidates any buffered read data from the stream. | |
Public Member Functions inherited from CeresEngine::FilteredInputStream | |
| FilteredInputStream (InputStream &&inputStream) | |
| Creates a new filtered data stream. | |
| FilteredInputStream (FilteredInputStream &&) noexcept=default | |
| ~FilteredInputStream () override=default | |
| InputStream & | getInputStream () noexcept |
| The data stream being filtered. | |
| const InputStream & | getInputStream () const noexcept |
| The data stream being filtered. | |
| bool | isSeekable (const Seek mode=Seek::Start) const noexcept override |
| Checks if the stream is seekable. | |
| void | seek (const std::streamsize position, const Seek mode=Seek::Start) override |
| Changes the position of the data stream. | |
| bool | isTellable () const noexcept override |
| Checks if the stream knows it's current absolute position. | |
| size_t | tell () override |
| Gets the absolute stream position, in bytes. | |
| bool | isSizeKnown () const noexcept override |
| Checks if the stream knows the size of the data. | |
| size_t | size () override |
| Gets the number of bytes available on the stream. | |
| bool | isReadable () const noexcept override |
| Checks if the stream is readable. | |
| size_t | read (void *data, const size_t n) override |
Reads data from the data stream to a buffer of raw memory data with length n. | |
| bool | invalidate () override |
| In the stream is buffered, invalidates any buffered read data from the stream. | |
Public Member Functions inherited from CeresEngine::IInputStream | |
| template<typename T > | |
| size_t | read (const MemoryView< T > &memoryView) |
| Reads data from the strea into a memory view. | |
| template<typename T > | |
| size_t | read (const StridedMemoryView< T > &memoryView) |
| Reads data from the stream into a strided memory view. | |
| Optional< String > | readString () |
Reads data from the buffer as a C++ String. | |
| template<typename T > requires std::is_trivially_copyable_v<T> | |
| Optional< T > | read () |
| Reads a trivially copyable obhect from the stream. | |
Public Member Functions inherited from CeresEngine::IStream | |
| IStream ()=default | |
| IStream (const IStream &) noexcept=delete | |
| IStream & | operator= (const IStream &) noexcept=delete |
| IStream (IStream &&) noexcept=default | |
| IStream & | operator= (IStream &&) noexcept=default |
| virtual | ~IStream () noexcept=default |
| void | skip (const size_t n) |
Skips n bytes from the data stream. | |
Private Types | |
| using | super = FilteredInputStream |
Private Member Functions | |
| void | invalidateReadBuffer () |
Private Attributes | |
| ByteMemoryView | mBuffer |
| ByteMemoryView | mBufferData |
Additional Inherited Members | |
Public Types inherited from CeresEngine::IStream | |
| enum class | Seek { Start = SEEK_SET , Current = SEEK_CUR , End = SEEK_END } |
| An enumeration that describes how a data stream should be seeked. More... | |
Protected Attributes inherited from CeresEngine::FilteredInputStream | |
| InputStream | mInputStream |
| The data stream being filtered. | |
A filtered InputStream that caches read and write operations to it's underlying InputStream.
|
explicit |
Creates a new buffer data stream.
| bufferSize | Size of the memory chunk in bytes. |
|
delete |
|
noexcept |
|
final |
Destroys the buffered data stream.
|
finalvirtual |
In the stream is buffered, invalidates any buffered read data from the stream.
Non-buffered streams are free to ignore this method.
Reimplemented from CeresEngine::IInputStream.
|
private |
Reads data from the data stream to a buffer of raw memory data with length n.
isReadable() returns true.| data | The memory location to which read data should be placed. |
| n | The maximum number of bytes to be read from the data stream. |
n. If 0, indicates that the stream has ended. Reimplemented from CeresEngine::IInputStream.
|
finalvirtual |
Changes the position of the data stream.
isSeekable() returns true.| position | The position to set the data stream to. |
| mode | The mode to change the data stream position. |
Reimplemented from CeresEngine::IStream.
|
finalvirtual |
Gets the absolute stream position, in bytes.
isTellable() returns true. Reimplemented from CeresEngine::IStream.
|
private |
|
private |