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 byte *data, size_t size)
 Construct new InputBuffer, typically the data and size parameters will come from a MemBuffer object. More...
 
void read (void *result, size_t len)
 Read the given number of bytes. More...
 
void skip (size_t len)
 Skip the given number of bytes. More...
 
const bytegetCurrentPos () const
 Return a pointer to the current position in the buffer. More...
 

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 139 of file SerializeBuffer.hh.

Constructor & Destructor Documentation

◆ InputBuffer()

openmsx::InputBuffer::InputBuffer ( const byte data,
size_t  size 
)

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

Definition at line 92 of file SerializeBuffer.cc.

Member Function Documentation

◆ getCurrentPos()

const byte* 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 173 of file SerializeBuffer.hh.

◆ 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 151 of file SerializeBuffer.hh.

◆ 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 162 of file SerializeBuffer.hh.


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