VMware GemFire Native C++ Reference
9.1
|
Provide operations for reading primitive data values, byte arrays, strings, Serializable
objects from a byte stream.
More...
Public Member Functions | |
void | advanceCursor (int32_t offset) |
advance the cursor by given offset More... | |
const uint8_t * | currentBufferPosition () const |
Get the pointer to current buffer position. More... | |
DataInput (const uint8_t *m_buffer, int32_t len) | |
constructor given a pre-allocated byte array with size More... | |
int32_t | getBytesRead () const |
get the number of bytes read in the buffer More... | |
int32_t | getBytesRemaining () const |
get the number of bytes remaining to be read in the buffer More... | |
void | read (uint8_t *value) |
Read an unsigned byte from the DataInput . More... | |
void | read (int8_t *value) |
Read a signed byte from the DataInput . More... | |
void | readArrayLen (int32_t *len) |
Read a 32-bit signed integer array length value from the DataInput in a manner compatible with java server's DataSerializer.readArrayLength . More... | |
void | readASCII (char **value, uint16_t *len=NULL) |
Allocates a c string buffer, and reads an ASCII string having maximum length of 64K from DataInput into it. More... | |
void | readASCIIHuge (char **value, uint32_t *len=NULL) |
Allocates a c string buffer, and reads an ASCII string from DataInput into it. More... | |
void | readBoolean (bool *value) |
Read a boolean value from the DataInput . More... | |
void | readBytes (uint8_t **bytes, int32_t *len) |
Read an array of unsigned bytes from the DataInput expecting to find the length of array in the stream at the start. More... | |
void | readBytes (int8_t **bytes, int32_t *len) |
Read an array of signed bytes from the DataInput expecting to find the length of array in the stream at the start. More... | |
void | readBytesOnly (uint8_t *buffer, uint32_t len) |
Read the given number of unsigned bytes from the DataInput . More... | |
void | readBytesOnly (int8_t *buffer, uint32_t len) |
Read the given number of signed bytes from the DataInput . More... | |
void | readDouble (double *value) |
Read a double precision number from the DataInput . More... | |
void | readFloat (float *value) |
Read a float from the DataInput . More... | |
void | readInt (uint16_t *value) |
Read a 16-bit unsigned integer from the DataInput . More... | |
void | readInt (uint32_t *value) |
Read a 32-bit unsigned integer from the DataInput . More... | |
void | readInt (uint64_t *value) |
Read a 64-bit unsigned integer from the DataInput . More... | |
void | readInt (int16_t *value) |
Read a 16-bit signed integer from the DataInput . More... | |
void | readInt (int32_t *value) |
Read a 32-bit signed integer from the DataInput . More... | |
void | readInt (int64_t *value) |
Read a 64-bit signed integer from the DataInput . More... | |
template<class PTR > | |
void | readObject (SharedPtr< PTR > &ptr, bool throwOnError=false) |
Read a Serializable object from the DataInput . More... | |
void | readObject (SerializablePtr &ptr) |
Read a Serializable object from the DataInput . More... | |
void | readUnsignedVL (int64_t *value) |
Decode a 64 bit integer as a variable length array. More... | |
void | readUTF (char **value, uint16_t *len=NULL) |
Allocates a c string buffer, and reads a java modified UTF-8 encoded string having maximum encoded length of 64K from DataInput into it. More... | |
void | readUTF (wchar_t **value, uint16_t *len=NULL) |
Allocates a wide-character string buffer, and reads a java modified UTF-8 encoded string having maximum encoded length of 64K from DataInput into it. More... | |
void | readUTFHuge (char **value, uint32_t *len=NULL) |
Allocates a c string buffer, and reads a java modified UTF-8 encoded string from DataInput into it. More... | |
void | readUTFHuge (wchar_t **value, uint32_t *len=NULL) |
Allocates a wide-character string buffer, and reads a java modified UTF-8 encoded string from DataInput into it. More... | |
void | readUTFNoLen (wchar_t **value, uint16_t decodedLen) |
Reads a java modified UTF-8 encoded string having maximum encoded length of 64K without reading the length which must be passed as a parameter. More... | |
void | reset () |
reset the cursor to the start of buffer More... | |
void | rewindCursor (int32_t offset) |
rewind the cursor by given offset More... | |
~DataInput () | |
destructor More... | |
Static Public Member Functions | |
static void | freeUTFMemory (char *value) |
free the C string allocated by readASCII , readASCIIHuge , readUTF , readUTFHuge methods More... | |
static void | freeUTFMemory (wchar_t *value) |
free the wide-characted string allocated by readASCII , readASCIIHuge , readUTF , readUTFHuge methods More... | |
static int32_t | getDecodedLength (const uint8_t *value, int32_t length) |
Get the length required to represent a given UTF-8 encoded string (created using DataOutput::writeUTF or java.io.DataOutput.writeUTF ) in wide-character format. More... | |
Provide operations for reading primitive data values, byte arrays, strings, Serializable
objects from a byte stream.
This class is intentionally not thread safe.
|
inline |
constructor given a pre-allocated byte array with size
|
inline |
destructor
|
inline |
advance the cursor by given offset
|
inline |
Get the pointer to current buffer position.
This should be treated as readonly and modification of contents using this internal pointer has undefined behavior.
|
inlinestatic |
free the C string allocated by readASCII
, readASCIIHuge
, readUTF
, readUTFHuge
methods
|
inlinestatic |
free the wide-characted string allocated by readASCII
, readASCIIHuge
, readUTF
, readUTFHuge
methods
|
inline |
get the number of bytes read in the buffer
|
inline |
get the number of bytes remaining to be read in the buffer
|
inlinestatic |
Get the length required to represent a given UTF-8 encoded string (created using DataOutput::writeUTF or java.io.DataOutput.writeUTF
) in wide-character format.
value | The UTF-8 encoded stream. |
length | The length of the stream to be read. |
|
inline |
Read an unsigned byte from the DataInput
.
value | output parameter to hold the unsigned byte read from stream |
|
inline |
Read a signed byte from the DataInput
.
value | output parameter to hold the signed byte read from stream |
|
inline |
Read a 32-bit signed integer array length value from the DataInput
in a manner compatible with java server's DataSerializer.readArrayLength
.
len | output parameter to hold the 32-bit signed length read from stream |
|
inline |
Allocates a c string buffer, and reads an ASCII string having maximum length of 64K from DataInput
into it.
freeUTFMemory
when done. Like DataOutput::writeASCII
the maximum length supported by this method is 64K; use readASCIIHuge
or readBytes
to read strings of length larger than this.value | output C string to hold the read characters; it is allocated by this method |
len | output parameter to hold the number of characters read from stream; not set if NULL |
|
inline |
Allocates a c string buffer, and reads an ASCII string from DataInput
into it.
freeUTFMemory
when done. Use this instead of readUTF
when reading a string of length greater than 64K.value | output C string to hold the read characters; it is allocated by this method |
len | output parameter to hold the number of characters read from stream; not set if NULL |
|
inline |
Read a boolean value from the DataInput
.
value | output parameter to hold the boolean read from stream |
|
inline |
Read an array of unsigned bytes from the DataInput
expecting to find the length of array in the stream at the start.
DataOutput::writeBytes
.bytes | output array to hold the bytes read from stream; the array is allocated by this method |
len | output parameter to hold the length of array read from stream |
|
inline |
Read an array of signed bytes from the DataInput
expecting to find the length of array in the stream at the start.
DataOutput::writeBytes
.bytes | output array to hold the bytes read from stream; the array is allocated by this method |
len | output parameter to hold the length of array read from stream |
|
inline |
Read the given number of unsigned bytes from the DataInput
.
DataOutput::writeBytesOnly
and, unlike readBytes
, does not expect the length of array in the stream.buffer | array to hold the bytes read from stream |
len | number of unsigned bytes to be read |
|
inline |
Read the given number of signed bytes from the DataInput
.
DataOutput::writeBytesOnly
and, unlike readBytes
, does not expect the length of array in the stream.buffer | array to hold the bytes read from stream |
len | number of signed bytes to be read |
|
inline |
Read a double precision number from the DataInput
.
value | output parameter to hold the double precision number read from stream |
|
inline |
Read a float from the DataInput
.
value | output parameter to hold the float read from stream |
|
inline |
Read a 16-bit unsigned integer from the DataInput
.
value | output parameter to hold the 16-bit unsigned integer read from stream |
|
inline |
Read a 32-bit unsigned integer from the DataInput
.
value | output parameter to hold the 32-bit unsigned integer read from stream |
|
inline |
Read a 64-bit unsigned integer from the DataInput
.
value | output parameter to hold the 64-bit unsigned integer read from stream |
|
inline |
Read a 16-bit signed integer from the DataInput
.
value | output parameter to hold the 16-bit signed integer read from stream |
|
inline |
Read a 32-bit signed integer from the DataInput
.
value | output parameter to hold the 32-bit signed integer read from stream |
|
inline |
Read a 64-bit signed integer from the DataInput
.
value | output parameter to hold the 64-bit signed integer read from stream |
|
inline |
Read a Serializable
object from the DataInput
.
Null objects are handled. This accepts an argument throwOnError
that specifies whether to check the type dynamically and throw a ClassCastException
when the cast fails.
ptr | The object to be read which is output by reference. The type of this must match the type of object that the application expects. |
throwOnError | Throw a ClassCastException when the type of object does not match ptr . Default is true when GF_DEBUG_ASSERTS macro is set and false in normal case. |
ClassCastException | When dynCast fails for the given ptr . |
|
inline |
Read a Serializable
object from the DataInput
.
Null objects are handled.
|
inline |
Decode a 64 bit integer as a variable length array.
This is taken from the varint encoding in protobufs (BSD licensed). See https://developers.google.com/protocol-buffers/docs/encoding
|
inline |
Allocates a c string buffer, and reads a java modified UTF-8 encoded string having maximum encoded length of 64K from DataInput
into it.
freeUTFMemory
when done. Like DataOutput::writeUTF
the maximum length supported by this method is 64K; use readAUTFHuge
to read strings of length larger than this.value | output C string to hold the read characters; it is allocated by this method |
len | output parameter to hold the number of characters read from stream; not set if NULL |
|
inline |
Allocates a wide-character string buffer, and reads a java modified UTF-8 encoded string having maximum encoded length of 64K from DataInput
into it.
freeUTFMemory
when done. Like DataOutput::writeUTF
the maximum length supported by this method is 64K; use readAUTFHuge
to read strings of length larger than this.value | output wide-character string to hold the read characters; it is allocated by this method |
len | output parameter to hold the number of characters read from stream; not set if NULL |
|
inline |
Allocates a c string buffer, and reads a java modified UTF-8 encoded string from DataInput
into it.
freeUTFMemory
when done. Use this instead of readUTF
when reading a string of length greater than 64K.value | output C string to hold the read characters; it is allocated by this method |
len | output parameter to hold the number of characters read from stream; not set if NULL |
|
inline |
Allocates a wide-character string buffer, and reads a java modified UTF-8 encoded string from DataInput
into it.
freeUTFMemory
when done. Use this instead of readUTF
when reading a string of length greater than 64K.value | output wide-character string to hold the read characters; it is allocated by this method |
len | output parameter to hold the number of characters read from stream; not set if NULL |
|
inline |
Reads a java modified UTF-8 encoded string having maximum encoded length of 64K without reading the length which must be passed as a parameter.
Allocates a c string buffer, and deserializes into it. Sets integer at length to hold the length of the string. Value is modified to point to the new allocation. The chars are allocated as an array, so the caller must use freeUTFMemory when done. If len == NULL, then the decoded string length is not set.
|
inline |
reset the cursor to the start of buffer
|
inline |
rewind the cursor by given offset