byteme
C++ wrappers for buffered inputs
Loading...
Searching...
No Matches
byteme::SomeBufferReader Class Referencefinal

Read a buffer that may or may not be Gzip/Zlib-compressed. More...

#include <SomeBufferReader.hpp>

Inheritance diagram for byteme::SomeBufferReader:
Collaboration diagram for byteme::SomeBufferReader:

Public Member Functions

 SomeBufferReader (const unsigned char *buffer, std::size_t length, const SomeBufferReaderOptions &options)
 
bool load ()
 
const unsigned char * buffer () const
 
std::size_t available () const
 
- Public Member Functions inherited from byteme::Reader

Detailed Description

Read a buffer that may or may not be Gzip/Zlib-compressed.

This class will automatically detect whether buffer refers to a text or Gzip/Zlib-compressed buffer, based on the initial magic numbers. After that, it will dispatch appropriately to RawBufferReader or ZlibBufferReader respectively.

Constructor & Destructor Documentation

◆ SomeBufferReader()

byteme::SomeBufferReader::SomeBufferReader ( const unsigned char * buffer,
std::size_t length,
const SomeBufferReaderOptions & options )
inline
Parameters
[in]bufferPointer to an array containing the possibly compressed data.
lengthLength of the buffer array.
optionsFurther options.

Member Function Documentation

◆ available()

std::size_t byteme::SomeBufferReader::available ( ) const
inlinevirtual

This method should only be called after load() has been called and returns true. The return value is generally expected to be positive; however, it is possible to return a zero. Note that zero values should not be interpreted as the end of the source, which is strictly only defined by load() returning false.

Returns
Number of available bytes in buffer().

Implements byteme::Reader.

◆ buffer()

const unsigned char * byteme::SomeBufferReader::buffer ( ) const
inlinevirtual

This method should only be called after load() has been called and returns true.

Returns
Pointer to the start of an array containing the available bytes. The number of available bytes is provided in available().

Implements byteme::Reader.

◆ load()

bool byteme::SomeBufferReader::load ( )
inlinevirtual

Read the next chunk of bytes from the input source. To read the entire source, this function should be called repeatedly until false is returned.

Returns
Boolean indicating whether the read was successful. If false, it can be assumed that the end of the source was reached.

Implements byteme::Reader.


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