Pivotal GemFire Native C++ Reference  10.1.3
apache::geode::client::DataOutput Class Reference

Provide operations for writing primitive data values, byte arrays, strings, Serializable objects to a byte stream. More...

Public Member Functions

void advanceCursor (size_t offset)
 Advance the buffer cursor by the given offset. More...
 
const uint8_t * getBuffer () const
 Get a pointer to the internal buffer of DataOutput. More...
 
const uint8_t * getBuffer (size_t *rsize) const
 Get a pointer to the internal buffer of DataOutput. More...
 
size_t getBufferLength () const
 Get the length of current data in the internal buffer of DataOutput. More...
 
const uint8_t * getCursor ()
 Get an internal pointer to the current location in the DataOutput byte array. More...
 
size_t getRemainingBufferLength () const
 Get a pointer to the internal buffer of DataOutput. More...
 
void reset ()
 Reset the internal cursor to the start of the buffer. More...
 
void rewindCursor (size_t offset)
 Rewind the buffer cursor by the given offset. More...
 
void write (int8_t value)
 Write a signed byte to the DataOutput. More...
 
void write (uint8_t value)
 Write an unsigned byte to the DataOutput. More...
 
void writeArrayLen (int32_t len)
 Write a 32-bit signed integer array length value to the DataOutput in a manner compatible with java server's DataSerializer.writeArrayLength. More...
 
void writeBoolean (bool value)
 Write a boolean value to the DataOutput. More...
 
void writeBytes (const int8_t *bytes, int32_t len)
 Write an array of signed bytes to the DataOutput. More...
 
void writeBytes (const uint8_t *bytes, int32_t len)
 Write an array of unsigned bytes to the DataOutput. More...
 
void writeBytesOnly (const int8_t *bytes, size_t len)
 Write an array of signed bytes without its length to the DataOutput. More...
 
void writeBytesOnly (const uint8_t *bytes, size_t len)
 Write an array of unsigned bytes without its length to the DataOutput. More...
 
void writeChar (uint16_t value)
 Write a 16-bit Char (wchar_t) value to the DataOutput. More...
 
template<class _CharT >
void writeChars (const _CharT *value)
 Writes a sequence of UTF-16 code units representing the given string value. More...
 
template<class _CharT , class... _Tail>
void writeChars (const std::basic_string< _CharT, _Tail... > &value)
 Writes a sequence of UTF-16 code units representing the given string value. More...
 
void writeDouble (double value)
 Write a double precision real number to the DataOutput. More...
 
void writeFloat (float value)
 Write a float value to the DataOutput. More...
 
void writeInt (int16_t value)
 Write a 16-bit signed integer value to the DataOutput. More...
 
void writeInt (int32_t value)
 Write a 32-bit signed integer value to the DataOutput. More...
 
void writeInt (int64_t value)
 Write a 64-bit signed integer value to the DataOutput. More...
 
void writeInt (uint16_t value)
 Write a 16-bit unsigned integer value to the DataOutput. More...
 
void writeInt (uint32_t value)
 Write a 32-bit unsigned integer value to the DataOutput. More...
 
void writeInt (uint64_t value)
 Write a 64-bit unsigned integer value to the DataOutput. More...
 
template<class PTR >
void writeObject (const std::shared_ptr< PTR > &objptr, bool isDelta=false)
 Write a Serializable object to the DataOutput. More...
 
virtual ~DataOutput () noexcept
 Destruct a DataOutput, including releasing the created buffer. More...
 

Protected Member Functions

 DataOutput (const CacheImpl *cache, Pool *pool)
 Construct a new DataOutput. More...
 

Detailed Description

Provide operations for writing primitive data values, byte arrays, strings, Serializable objects to a byte stream.

This class is intentionally not thread safe.

Constructor & Destructor Documentation

◆ ~DataOutput()

virtual apache::geode::client::DataOutput::~DataOutput ( )
inlinevirtualnoexcept

Destruct a DataOutput, including releasing the created buffer.

◆ DataOutput()

apache::geode::client::DataOutput::DataOutput ( const CacheImpl *  cache,
Pool pool 
)
protected

Construct a new DataOutput.

Member Function Documentation

◆ advanceCursor()

void apache::geode::client::DataOutput::advanceCursor ( size_t  offset)
inline

Advance the buffer cursor by the given offset.

Parameters
offsetthe offset by which to advance the cursor

◆ getBuffer() [1/2]

const uint8_t* apache::geode::client::DataOutput::getBuffer ( ) const
inline

Get a pointer to the internal buffer of DataOutput.

◆ getBuffer() [2/2]

const uint8_t* apache::geode::client::DataOutput::getBuffer ( size_t *  rsize) const
inline

Get a pointer to the internal buffer of DataOutput.

Parameters
rsizethe size of buffer is filled in this output parameter; should not be nullptr

◆ getBufferLength()

size_t apache::geode::client::DataOutput::getBufferLength ( ) const
inline

Get the length of current data in the internal buffer of DataOutput.

◆ getCursor()

const uint8_t* apache::geode::client::DataOutput::getCursor ( )
inline

Get an internal pointer to the current location in the DataOutput byte array.

◆ getRemainingBufferLength()

size_t apache::geode::client::DataOutput::getRemainingBufferLength ( ) const
inline

Get a pointer to the internal buffer of DataOutput.

◆ reset()

void apache::geode::client::DataOutput::reset ( )
inline

Reset the internal cursor to the start of the buffer.

◆ rewindCursor()

void apache::geode::client::DataOutput::rewindCursor ( size_t  offset)
inline

Rewind the buffer cursor by the given offset.

Parameters
offsetthe offset by which to rewind the cursor

◆ write() [1/2]

void apache::geode::client::DataOutput::write ( int8_t  value)
inline

Write a signed byte to the DataOutput.

Parameters
valuethe signed byte to be written

◆ write() [2/2]

void apache::geode::client::DataOutput::write ( uint8_t  value)
inline

Write an unsigned byte to the DataOutput.

Parameters
valuethe unsigned byte to be written

◆ writeArrayLen()

void apache::geode::client::DataOutput::writeArrayLen ( int32_t  len)
inline

Write a 32-bit signed integer array length value to the DataOutput in a manner compatible with java server's DataSerializer.writeArrayLength.

Parameters
valuethe 32-bit signed integer array length to be written

◆ writeBoolean()

void apache::geode::client::DataOutput::writeBoolean ( bool  value)
inline

Write a boolean value to the DataOutput.

Parameters
valuethe boolean value to be written

◆ writeBytes() [1/2]

void apache::geode::client::DataOutput::writeBytes ( const int8_t *  bytes,
int32_t  len 
)
inline

Write an array of signed bytes to the DataOutput.

Parameters
valuethe array of signed bytes to be written
lenthe number of bytes from the start of array to be written

◆ writeBytes() [2/2]

void apache::geode::client::DataOutput::writeBytes ( const uint8_t *  bytes,
int32_t  len 
)
inline

Write an array of unsigned bytes to the DataOutput.

Parameters
valuethe array of unsigned bytes to be written
lenthe number of bytes from the start of array to be written

◆ writeBytesOnly() [1/2]

void apache::geode::client::DataOutput::writeBytesOnly ( const int8_t *  bytes,
size_t  len 
)
inline

Write an array of signed bytes without its length to the DataOutput.

Remarks
The difference between this and writeBytes is that this does write the length of bytes so the corresponding DataInput::readBytesOnly (unlike DataInput::readBytes) needs the length argument explicitly.
Parameters
valuethe array of signed bytes to be written
lenthe number of bytes from the start of array to be written

◆ writeBytesOnly() [2/2]

void apache::geode::client::DataOutput::writeBytesOnly ( const uint8_t *  bytes,
size_t  len 
)
inline

Write an array of unsigned bytes without its length to the DataOutput.

Remarks
The difference between this and writeBytes is that this does write the length of bytes so the corresponding DataInput::readBytesOnly (unlike DataInput::readBytes) needs the length argument explicitly.
Parameters
valuethe array of unsigned bytes to be written
lenthe number of bytes from the start of array to be written

◆ writeChar()

void apache::geode::client::DataOutput::writeChar ( uint16_t  value)
inline

Write a 16-bit Char (wchar_t) value to the DataOutput.

Parameters
valuethe 16-bit wchar_t value to be written

◆ writeChars() [1/2]

template<class _CharT >
void apache::geode::client::DataOutput::writeChars ( const _CharT *  value)
inline

Writes a sequence of UTF-16 code units representing the given string value.

The output does not contain any length of termination charactes.

Equivalent to:

writeChars(std::basic_string<_CharT>(value));
Template Parameters
_CharTmatches character type used for std::basic_string.
Parameters
valueNULL (\u0000) terminated string to write as UTF-16 units

◆ writeChars() [2/2]

template<class _CharT , class... _Tail>
void apache::geode::client::DataOutput::writeChars ( const std::basic_string< _CharT, _Tail... > &  value)
inline

Writes a sequence of UTF-16 code units representing the given string value.

The output does not contain any length of termination charactes.

Template Parameters
_CharTmatches character type of std::basic_string.
_Tailmatches all remaining template parameters for std::basic_string.
Parameters
valuestring to write as UTF-16 units

◆ writeDouble()

void apache::geode::client::DataOutput::writeDouble ( double  value)
inline

Write a double precision real number to the DataOutput.

Parameters
valuethe double precision real number to be written

◆ writeFloat()

void apache::geode::client::DataOutput::writeFloat ( float  value)
inline

Write a float value to the DataOutput.

Parameters
valuethe float value to be written

◆ writeInt() [1/6]

void apache::geode::client::DataOutput::writeInt ( int16_t  value)
inline

Write a 16-bit signed integer value to the DataOutput.

Parameters
valuethe 16-bit signed integer value to be written

◆ writeInt() [2/6]

void apache::geode::client::DataOutput::writeInt ( int32_t  value)
inline

Write a 32-bit signed integer value to the DataOutput.

Parameters
valuethe 32-bit signed integer value to be written

◆ writeInt() [3/6]

void apache::geode::client::DataOutput::writeInt ( int64_t  value)
inline

Write a 64-bit signed integer value to the DataOutput.

Parameters
valuethe 64-bit signed integer value to be written

◆ writeInt() [4/6]

void apache::geode::client::DataOutput::writeInt ( uint16_t  value)
inline

Write a 16-bit unsigned integer value to the DataOutput.

Parameters
valuethe 16-bit unsigned integer value to be written

◆ writeInt() [5/6]

void apache::geode::client::DataOutput::writeInt ( uint32_t  value)
inline

Write a 32-bit unsigned integer value to the DataOutput.

Parameters
valuethe 32-bit unsigned integer value to be written

◆ writeInt() [6/6]

void apache::geode::client::DataOutput::writeInt ( uint64_t  value)
inline

Write a 64-bit unsigned integer value to the DataOutput.

Parameters
valuethe 64-bit unsigned integer value to be written

◆ writeObject()

template<class PTR >
void apache::geode::client::DataOutput::writeObject ( const std::shared_ptr< PTR > &  objptr,
bool  isDelta = false 
)
inline

Write a Serializable object to the DataOutput.

Parameters
objptrsmart pointer to the Serializable object to be written
apache::geode::client::DataOutput::writeChars
void writeChars(const std::basic_string< _CharT, _Tail... > &value)
Writes a sequence of UTF-16 code units representing the given string value.
Definition: DataOutput.hpp:309

Apache Geode C++ Cache API Documentation