openMSX
Public Member Functions | List of all members
openmsx::InputBuffer Class Reference

This class is complementary to the OutputBuffer class. More...

#include <SerializeBuffer.hh>

Public Member Functions

 InputBuffer (const uint8_t *data, size_t size)
 Construct new InputBuffer, typically the data and size parameters will come from a MemBuffer object.
 
void read (void *result, size_t len)
 Read the given number of bytes.
 
void skip (size_t len)
 Skip the given number of bytes.
 
const uint8_t * getCurrentPos () const
 Return a pointer to the current position in the buffer.
 

Detailed Description

This class is complementary to the OutputBuffer class.

Instead of filling an initially empty buffer it starts from a filled buffer and allows to retrieve items starting from the start of the buffer.

Definition at line 176 of file SerializeBuffer.hh.

Constructor & Destructor Documentation

◆ InputBuffer()

openmsx::InputBuffer::InputBuffer ( const uint8_t *  data,
size_t  size 
)

Construct new InputBuffer, typically the data and size parameters will come from a MemBuffer object.

Definition at line 97 of file SerializeBuffer.cc.

Member Function Documentation

◆ getCurrentPos()

const uint8_t * openmsx::InputBuffer::getCurrentPos ( ) const
inline

Return a pointer to the current position in the buffer.

This is useful if you don't want to copy the data, but e.g. use it as input for an uncompress algorithm. You can later use skip() to actually consume the data.

Definition at line 210 of file SerializeBuffer.hh.

Referenced by openmsx::MemInputArchive::loadStr(), and openmsx::MemInputArchive::serialize_blob().

◆ read()

void openmsx::InputBuffer::read ( void *  result,
size_t  len 
)
inline

Read the given number of bytes.

This 'consumes' the read bytes, so a future read() will continue where this read stopped.

Definition at line 188 of file SerializeBuffer.hh.

Referenced by openmsx::MemInputArchive::serialize().

◆ skip()

void openmsx::InputBuffer::skip ( size_t  len)
inline

Skip the given number of bytes.

This is similar to a read(), but it will only consume the data, not copy it.

Definition at line 199 of file SerializeBuffer.hh.

Referenced by openmsx::MemInputArchive::loadStr(), openmsx::MemInputArchive::serialize_blob(), and openmsx::MemInputArchive::skipSection().


The documentation for this class was generated from the following files: