VMware GemFire Native Client Cache Reference  9.0.6
DataOutput.hpp
Go to the documentation of this file.
1 #ifndef __GEMFIRE_DATAOUTPUT_H__
2 #define __GEMFIRE_DATAOUTPUT_H__
3 
4 /*=========================================================================
5  * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
6  * This product is protected by U.S. and international copyright
7  * and intellectual property laws. Pivotal products are covered by
8  * more patents listed at http://www.pivotal.io/patents.
9  *=========================================================================
10  */
11 
12 #include "gfcpp_globals.hpp"
13 #include "ExceptionTypes.hpp"
14 #include "Log.hpp"
15 #include "Serializable.hpp"
16 #include "CacheableString.hpp"
17 
18 extern "C" {
19 #include <string.h>
20 #include <stdlib.h>
21 }
22 
27 namespace gemfire {
28 
33 #define GF_ALLOC(v,t,s) \
34 { \
35  v = (t*)malloc((s) * sizeof(t)); \
36  if ((v) == NULL) { \
37  throw OutOfMemoryException( \
38  "Out of Memory while allocating buffer for "#t" of size "#s); \
39  } \
40 }
41 
46 #define GF_RESIZE(v,t,s) \
47 { \
48  v = (t*)realloc(v, (s) * sizeof(t)); \
49  if ((v) == NULL) { \
50  throw OutOfMemoryException( \
51  "Out of Memory while resizing buffer for "#t); \
52  } \
53 }
54 
55 #define GF_FREE(v) free(v)
56 
63 {
64 public:
65 
70  DataOutput();
71 
77  inline void write(uint8_t value)
78  {
79  ensureCapacity(1);
80  writeNoCheck(value);
81  }
82 
88  inline void write(int8_t value)
89  {
90  write((uint8_t)value);
91  }
92 
98  inline void writeBoolean( bool value )
99  {
100  write( (uint8_t)value );
101  }
102 
109  inline void writeBytes( const uint8_t* bytes, int32_t len )
110  {
111  if (len >= 0) {
112  ensureCapacity( len + 5 );
113  writeArrayLen( bytes==NULL ? 0 : len ); // length of bytes...
114  if ( len > 0 && bytes != NULL) {
115  memcpy( m_buf, bytes, len );
116  m_buf += len;
117  }
118  } else {
119  write((int8_t) -1 );
120  }
121  }
122 
129  inline void writeBytes( const int8_t* bytes, int32_t len )
130  {
131  writeBytes( (const uint8_t*)bytes, len );
132  }
133 
145  inline void writeBytesOnly( const uint8_t* bytes, uint32_t len )
146  {
147  ensureCapacity( len );
148  memcpy( m_buf, bytes, len );
149  m_buf += len;
150  }
151 
163  inline void writeBytesOnly( const int8_t* bytes, uint32_t len )
164  {
165  writeBytesOnly( (const uint8_t*)bytes, len );
166  }
167 
173  inline void writeInt( uint16_t value )
174  {
175  ensureCapacity( 2 );
176  *(m_buf++) = (uint8_t)(value >> 8);
177  *(m_buf++) = (uint8_t)value;
178  }
179 
185  inline void writeChar( uint16_t value )
186  {
187  ensureCapacity( 2 );
188  *(m_buf++) = (uint8_t)(value >> 8);
189  *(m_buf++) = (uint8_t)value;
190  }
191 
197  inline void writeInt( uint32_t value )
198  {
199  ensureCapacity( 4 );
200  *(m_buf++) = (uint8_t)(value >> 24);
201  *(m_buf++) = (uint8_t)(value >> 16);
202  *(m_buf++) = (uint8_t)(value >> 8);
203  *(m_buf++) = (uint8_t)value;
204  }
205 
211  inline void writeInt( uint64_t value )
212  {
213  ensureCapacity( 8 );
214  // the defines are not reliable and can be changed by compiler options.
215  // Hence using sizeof() test instead.
216  //#if defined(_LP64) || ( defined(__WORDSIZE) && __WORDSIZE == 64 ) ||
217  //( defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64 )
218  if ( sizeof( long ) == 8 ) {
219  *(m_buf++) = (uint8_t)(value >> 56);
220  *(m_buf++) = (uint8_t)(value >> 48);
221  *(m_buf++) = (uint8_t)(value >> 40);
222  *(m_buf++) = (uint8_t)(value >> 32);
223  *(m_buf++) = (uint8_t)(value >> 24);
224  *(m_buf++) = (uint8_t)(value >> 16);
225  *(m_buf++) = (uint8_t)(value >> 8);
226  *(m_buf++) = (uint8_t)value;
227  } else {
228  uint32_t hword = (uint32_t)(value >> 32);
229  *(m_buf++) = (uint8_t)(hword >> 24);
230  *(m_buf++) = (uint8_t)(hword >> 16);
231  *(m_buf++) = (uint8_t)(hword >> 8);
232  *(m_buf++) = (uint8_t)hword;
233 
234  hword = (uint32_t)value;
235  *(m_buf++) = (uint8_t)(hword >> 24);
236  *(m_buf++) = (uint8_t)(hword >> 16);
237  *(m_buf++) = (uint8_t)(hword >> 8);
238  *(m_buf++) = (uint8_t)hword;
239  }
240  }
241 
247  inline void writeInt( int16_t value )
248  {
249  writeInt( (uint16_t)value );
250  }
251 
257  inline void writeInt( int32_t value )
258  {
259  writeInt( (uint32_t)value );
260  }
261 
267  inline void writeInt( int64_t value )
268  {
269  writeInt( (uint64_t)value );
270  }
271 
279  inline void writeArrayLen( int32_t len )
280  {
281  if (len == -1) {
282  write((int8_t) -1);
283  } else if (len <= 252) { // 252 is java's ((byte)-4 && 0xFF)
284  write((uint8_t)len);
285  } else if (len <= 0xFFFF) {
286  write((int8_t) -2);
287  writeInt((uint16_t)len);
288  } else {
289  write((int8_t) -3);
290  writeInt(len);
291  }
292  }
293 
299  inline void writeFloat( float value )
300  {
301  union float_uint32_t
302  {
303  float f;
304  uint32_t u;
305  }v;
306  v.f = value;
307  writeInt( v.u );
308  }
309 
315  inline void writeDouble( double value )
316  {
317  union double_uint64_t
318  {
319  double d;
320  uint64_t ll;
321  }v;
322  v.d = value;
323  writeInt( v.ll );
324  }
325 
338  inline void writeASCII(const char* value, uint32_t length = 0)
339  {
340  if ( value != NULL ) {
341  if ( length == 0 ) {
342  length = (uint32_t)strlen( value );
343  }
344  uint16_t len = (uint16_t)( length > 0xFFFF ? 0xFFFF : length );
345  writeInt( len );
346  writeBytesOnly( (int8_t*)value, len ); // K64
347  } else {
348  writeInt( (uint16_t)0 );
349  }
350  }
351 
352  inline void writeNativeString(const char* value)
353  {
354  //create cacheable string
355  //write typeid id.
356  //call todata
358  write(csPtr->typeId());
359  csPtr->toData(*this);
360  }
361 
373  inline void writeASCIIHuge(const char* value, uint32_t length = 0)
374  {
375  if ( value != NULL ) {
376  if ( length == 0 ) {
377  length = (uint32_t)strlen( value );
378  }
379  writeInt( (uint32_t) length );
380  writeBytesOnly( (int8_t*)value, (uint32_t) length );
381  } else {
382  writeInt( (uint32_t)0 );
383  }
384  }
385 
386 
397  inline void writeFullUTF(const char* value, uint32_t length = 0)
398  {
399  if ( value != NULL ) {
400  int32_t len = getEncodedLength( value, length );
401  uint16_t encodedLen = (uint16_t)( len > 0xFFFF ? 0xFFFF : len );
402  writeInt( (int32_t)encodedLen );
403  ensureCapacity( encodedLen );
404  write((int8_t)0); // isObject = 0 BYTE_CODE
405  uint8_t* end = m_buf + encodedLen;
406  while( m_buf < end ) {
407  encodeChar( *value++ );
408  }
409  if ( m_buf > end ) m_buf = end;
410  } else {
411  writeInt( (uint16_t)0 );
412  }
413  }
414 
426  inline void writeUTF(const char* value, uint32_t length = 0)
427  {
428  if ( value != NULL ) {
429  int32_t len = getEncodedLength( value, length );
430  uint16_t encodedLen = (uint16_t)( len > 0xFFFF ? 0xFFFF : len );
431  writeInt( encodedLen );
432  ensureCapacity( encodedLen );
433  uint8_t* end = m_buf + encodedLen;
434  while( m_buf < end ) {
435  encodeChar( *value++ );
436  }
437  if ( m_buf > end ) m_buf = end;
438  } else {
439  writeInt( (uint16_t)0 );
440  }
441  }
442 
455  inline void writeUTFHuge(const char* value, uint32_t length = 0)
456  {
457  if (value != NULL) {
458  if (length == 0) {
459  length = (uint32_t)strlen(value);
460  }
461  writeInt(length);
462  ensureCapacity(length * 2);
463  for (uint32_t pos = 0; pos < length; pos++) {
464  writeNoCheck((int8_t)0);
465  writeNoCheck((int8_t)value[pos]);
466  }
467  }
468  else {
469  writeInt((uint32_t)0);
470  }
471  }
472 
484  inline void writeUTF(const wchar_t* value, uint32_t length = 0)
485  {
486  if ( value != NULL ) {
487  int32_t len = getEncodedLength( value, length );
488  uint16_t encodedLen = (uint16_t)( len > 0xFFFF ? 0xFFFF : len );
489  writeInt( encodedLen );
490  ensureCapacity( encodedLen );
491  uint8_t* end = m_buf + encodedLen;
492  while( m_buf < end ) {
493  encodeChar( *value++ );
494  }
495  if ( m_buf > end ) m_buf = end;
496  } else {
497  writeInt( (uint16_t)0 );
498  }
499  }
500 
511  inline void writeUTFHuge(const wchar_t* value, uint32_t length = 0)
512  {
513  if (value != NULL) {
514  if (length == 0) {
515  length = (uint32_t)wcslen(value);
516  }
517  writeInt(length);
518  ensureCapacity(length * 2);
519  for (uint32_t pos = 0; pos < length; pos++) {
520  uint16_t item = (uint16_t)value[pos];
521  writeNoCheck((uint8_t)((item & 0xFF00) >> 8));
522  writeNoCheck((uint8_t)(item & 0xFF));
523  }
524  }
525  else {
526  writeInt((uint32_t)0);
527  }
528  }
529 
540  inline static int32_t getEncodedLength( const char* value,
541  int32_t length = 0, uint32_t* valLength = NULL )
542  {
543  if ( value == NULL ) return 0;
544  char currentChar;
545  int32_t encodedLen = 0;
546  const char* start = value;
547  if ( length == 0 ) {
548  while ( (currentChar = *value) != '\0' ) {
549  getEncodedLength( currentChar, encodedLen );
550  value++;
551  }
552  } else {
553  const char* end = value + length;
554  while ( value < end ) {
555  currentChar = *value;
556  getEncodedLength( currentChar, encodedLen );
557  value++;
558  }
559  }
560  if ( valLength != NULL ) {
561  *valLength = static_cast<uint32_t>(value - start);
562  }
563  return encodedLen;
564  }
565 
576  inline static int32_t getEncodedLength( const wchar_t* value,
577  int32_t length = 0, uint32_t* valLength = NULL )
578  {
579  if ( value == NULL ) return 0;
580  wchar_t currentChar;
581  int32_t encodedLen = 0;
582  const wchar_t* start = value;
583  if ( length == 0 ) {
584  while ( (currentChar = *value) != 0 ) {
585  getEncodedLength( currentChar, encodedLen );
586  value++;
587  }
588  } else {
589  const wchar_t* end = value + length;
590  while ( value < end ) {
591  currentChar = *value;
592  getEncodedLength( currentChar, encodedLen );
593  value++;
594  }
595  }
596  if ( valLength != NULL ) {
597  *valLength = static_cast<uint32_t>(value - start);
598  }
599  return encodedLen;
600  }
601 
608  template< class PTR >
609  void writeObject( const SharedPtr<PTR>& objptr, bool isDelta = false )
610  {
611  writeObjectInternal( objptr.ptr( ), isDelta );
612  }
613 
620  void writeObject( const Serializable* objptr )
621  {
622  writeObjectInternal( objptr );
623  }
624 
629  const uint8_t* getCursor()
630  {
631  return m_buf;
632  }
633 
639  void advanceCursor(uint32_t offset)
640  {
641  ensureCapacity(offset);
642  m_buf += offset;
643  }
644 
650  void rewindCursor(uint32_t offset)
651  {
652  m_buf -= offset;
653  }
654 
655  void updateValueAtPos(uint32_t offset, uint8_t value)
656  {
657  m_bytes[offset] = value;
658  }
659 
660  uint8_t getValueAtPos(uint32_t offset)
661  {
662  return m_bytes[offset];
663  }
666  {
667  reset();
668  DataOutput::checkinBuffer(m_bytes, m_size);
669  }
670 
674  inline const uint8_t* getBuffer( ) const
675  {
676  //GF_R_ASSERT(!((uint32_t)(m_bytes) % 4));
677  return m_bytes;
678  }
679 
683  inline uint32_t getRemainingBufferLength( ) const
684  {
685  //GF_R_ASSERT(!((uint32_t)(m_bytes) % 4));
686  return m_size - getBufferLength();
687  }
688 
695  inline const uint8_t* getBuffer( uint32_t* rsize ) const
696  {
697  *rsize = (uint32_t)( m_buf - m_bytes );
698  //GF_R_ASSERT(!((uint32_t)(m_bytes) % 4));
699  return m_bytes;
700  }
701 
702  inline uint8_t* getBufferCopy( )
703  {
704  uint32_t size = (uint32_t)( m_buf - m_bytes );
705  uint8_t * result;
706  GF_ALLOC(result, uint8_t, size);
707  memcpy( result, m_bytes, size );
708  return result;
709  }
710 
715  inline uint32_t getBufferLength() const {
716  return (uint32_t)( m_buf - m_bytes );
717  }
718 
722  inline void reset()
723  {
724  if (m_haveBigBuffer) {
725  // free existing buffer
726  GF_FREE(m_bytes);
727  // create smaller buffer
728  GF_ALLOC(m_bytes, uint8_t, m_lowWaterMark);
729  m_size = m_lowWaterMark;
730  // reset the flag
731  m_haveBigBuffer = false;
732  // release the lock
733  releaseLock();
734  }
735  m_buf = m_bytes;
736  }
737 
738  // make sure there is room left for the requested size item.
739  inline void ensureCapacity( uint32_t size )
740  {
741  uint32_t offset = (uint32_t)( m_buf - m_bytes );
742  if ( (m_size - offset) < size ) {
743  uint32_t newSize = m_size * 2 + (8192 * (size / 8192));
744  if (newSize >= m_highWaterMark && !m_haveBigBuffer) {
745  // acquire the lock
746  acquireLock();
747  // set flag
748  m_haveBigBuffer = true;
749  }
750  m_size = newSize;
751  GF_RESIZE( m_bytes, uint8_t, m_size );
752  m_buf = m_bytes + offset;
753  }
754  }
755 
756  /*
757  * This is for internal use
758  */
759  const char* getPoolName()
760  {
761  return m_poolName;
762  }
763 
764  /*
765  * This is for internal use
766  */
767  void setPoolName(const char* poolName)
768  {
769  m_poolName = poolName;
770  }
771 
772  uint8_t * getBufferCopyFrom(const uint8_t *from, uint32_t length)
773  {
774  uint8_t * result;
775  GF_NEW( result, uint8_t[ length ] );
776  memcpy( result, from, length);
777 
778  return result;
779  }
780 
781  static void safeDelete(uint8_t* src)
782  {
783  GF_SAFE_DELETE(src);
784  }
785 
786  static DataOutput* getDataOutput()
787  {
788  return new DataOutput();
789  }
790  static void releaseDataOutput(DataOutput* dataOutput)
791  {
792  GF_SAFE_DELETE(dataOutput);
793  }
794 private:
795 
796  void writeObjectInternal( const Serializable* ptr, bool isDelta = false );
797 
798  static void acquireLock();
799  static void releaseLock();
800 
801 
802 
803  const char* m_poolName;
804  // memory m_buffer to encode to.
805  uint8_t* m_bytes;
806  // cursor.
807  uint8_t* m_buf;
808  // size of m_bytes.
809  uint32_t m_size;
810  // high and low water marks for buffer size
811  static uint32_t m_lowWaterMark;
812  static uint32_t m_highWaterMark;
813  // flag to indicate we have a big buffer
814  volatile bool m_haveBigBuffer;
815 
816  inline static void getEncodedLength( const char val, int32_t& encodedLen )
817  {
818  if ( (val == 0) || (val & 0x80) ) {
819  // two byte.
820  encodedLen += 2;
821  } else {
822  // one byte.
823  encodedLen++;
824  }
825  }
826 
827  inline static void getEncodedLength( const wchar_t val, int32_t& encodedLen )
828  {
829  if( val == 0)
830  {
831  encodedLen += 2;
832  }
833  else if ( val < 0x80 )//ASCII character
834  {
835  encodedLen++;
836  }
837  else if ( val < 0x800 )
838  {
839  encodedLen += 2;
840  }
841  else
842  {
843  encodedLen += 3;
844  }
845  }
846 
847  inline void encodeChar( const char value )
848  {
849  uint8_t tmp = (uint8_t)value;
850  if ( (tmp == 0) || (tmp & 0x80) ) {
851  // two byte.
852  *(m_buf++) = (uint8_t)(0xc0 | ((tmp & 0xc0 ) >> 6));
853  *(m_buf++) = (uint8_t)(0x80 | (tmp & 0x3f ));
854  } else {
855  // one byte.
856  *(m_buf++) = tmp;
857  }
858  }
859 
860  // this will lose the character set encoding.
861  inline void encodeChar( const wchar_t value )
862  {
863  uint16_t c = (uint16_t)value;
864  if ( c == 0 ) {
865  *(m_buf++) = 0xc0;
866  *(m_buf++) = 0x80;
867  }
868  else if ( c < 0x80 ) {//ASCII character
869  *(m_buf++) = (uint8_t)c;
870  }
871  else if ( c < 0x800 ) {
872  *(m_buf++) = (uint8_t)( 0xC0 | c >> 6 );
873  *(m_buf++) = (uint8_t)( 0x80 | (c & 0x3F) );
874  }
875  else {
876  *(m_buf++) = (uint8_t)( 0xE0 | c >> 12 );
877  *(m_buf++) = (uint8_t)( 0x80 | ((c >> 6) & 0x3F) );
878  *(m_buf++) = (uint8_t)( 0x80 | (c & 0x3F) );
879  }
880  }
881 
882  inline void writeNoCheck(uint8_t value)
883  {
884  *(m_buf++) = value;
885  }
886 
887  inline void writeNoCheck(int8_t value)
888  {
889  writeNoCheck((uint8_t)value);
890  }
891 
892 
893  static uint8_t* checkoutBuffer( uint32_t* size );
894  static void checkinBuffer( uint8_t* buffer, uint32_t size );
895 
896  // disable copy constructor and assignment
897  DataOutput(const DataOutput&);
898  DataOutput& operator =(const DataOutput&);
899 };
900 
901 }
902 
903 #endif // __GEMFIRE_DATAOUTPUT_H__
void writeInt(int16_t value)
Write a 16-bit signed integer value to the DataOutput.
Definition: DataOutput.hpp:247
#define GF_ALLOC(v, t, s)
C style memory allocation that throws OutOfMemoryException if it fails.
Definition: DataOutput.hpp:33
virtual int8_t typeId() const
Return the typeId byte of the instance being serialized.
void writeInt(int64_t value)
Write a 64-bit signed integer value to the DataOutput.
Definition: DataOutput.hpp:267
Provide operations for writing primitive data values, byte arrays, strings, Serializable objects to a...
Definition: DataOutput.hpp:62
void writeASCIIHuge(const char *value, uint32_t length=0)
Writes the given ASCII string supporting upto maximum 32-bit integer value.
Definition: DataOutput.hpp:373
const uint8_t * getBuffer(uint32_t *rsize) const
Get a pointer to the internal buffer of DataOutput.
Definition: DataOutput.hpp:695
void rewindCursor(uint32_t offset)
Rewind the buffer cursor by the given offset.
Definition: DataOutput.hpp:650
void writeBytes(const uint8_t *bytes, int32_t len)
Write an array of unsigned bytes to the DataOutput.
Definition: DataOutput.hpp:109
virtual void toData(DataOutput &output) const
serialize this object
void writeDouble(double value)
Write a double precision real number to the DataOutput.
Definition: DataOutput.hpp:315
void advanceCursor(uint32_t offset)
Advance the buffer cursor by the given offset.
Definition: DataOutput.hpp:639
void writeBytesOnly(const uint8_t *bytes, uint32_t len)
Write an array of unsigned bytes without its length to the DataOutput.
Definition: DataOutput.hpp:145
void writeChar(uint16_t value)
Write a 16-bit Char (wchar_t) value to the DataOutput.
Definition: DataOutput.hpp:185
void writeUTFHuge(const char *value, uint32_t length=0)
Writes the given string using java modified UTF-8 encoding.
Definition: DataOutput.hpp:455
const uint8_t * getBuffer() const
Get a pointer to the internal buffer of DataOutput.
Definition: DataOutput.hpp:674
void write(uint8_t value)
Write an unsigned byte to the DataOutput.
Definition: DataOutput.hpp:77
uint32_t getBufferLength() const
Get the length of current data in the internal buffer of DataOutput.
Definition: DataOutput.hpp:715
const uint8_t * getCursor()
Get an internal pointer to the current location in the DataOutput byte array.
Definition: DataOutput.hpp:629
void writeInt(uint64_t value)
Write a 64-bit unsigned integer value to the DataOutput.
Definition: DataOutput.hpp:211
static CacheableStringPtr create(const char *value, int32_t len=0)
Factory method for creating an instance of CacheableString from a null terminated C string optionally...
Definition: CacheableString.hpp:102
void writeFullUTF(const char *value, uint32_t length=0)
Writes the given given string using java modified UTF-8 encoding supporting maximum encoded length of...
Definition: DataOutput.hpp:397
void writeFloat(float value)
Write a float value to the DataOutput.
Definition: DataOutput.hpp:299
void writeArrayLen(int32_t len)
Write a 32-bit signed integer array length value to the DataOutput in a manner compatible with java s...
Definition: DataOutput.hpp:279
void writeObject(const SharedPtr< PTR > &objptr, bool isDelta=false)
Write a Serializable object to the DataOutput.
Definition: DataOutput.hpp:609
void writeInt(uint16_t value)
Write a 16-bit unsigned integer value to the DataOutput.
Definition: DataOutput.hpp:173
#define GF_SAFE_DELETE(x)
Deletes x only if it exists.
Definition: gf_base.hpp:327
This namespace contains all the GemFire C++ API classes, enumerations and globals.
Definition: Assert.hpp:19
static int32_t getEncodedLength(const char *value, int32_t length=0, uint32_t *valLength=NULL)
Get the length required to represent a given wide-character string in java modified UTF-8 format...
Definition: DataOutput.hpp:540
void write(int8_t value)
Write a signed byte to the DataOutput.
Definition: DataOutput.hpp:88
#define GF_RESIZE(v, t, s)
C style memory re-allocation that throws OutOfMemoryException if it fails.
Definition: DataOutput.hpp:46
void writeObject(const Serializable *objptr)
Write a Serializable object to the DataOutput.
Definition: DataOutput.hpp:620
void writeBytesOnly(const int8_t *bytes, uint32_t len)
Write an array of signed bytes without its length to the DataOutput.
Definition: DataOutput.hpp:163
void writeBoolean(bool value)
Write a boolean value to the DataOutput.
Definition: DataOutput.hpp:98
This abstract base class is the superclass of all user objects in the cache that can be serialized...
Definition: Serializable.hpp:39
void writeUTFHuge(const wchar_t *value, uint32_t length=0)
Writes the given string using java modified UTF-8 encoding.
Definition: DataOutput.hpp:511
void writeInt(int32_t value)
Write a 32-bit signed integer value to the DataOutput.
Definition: DataOutput.hpp:257
#define CPPCACHE_EXPORT
Defines a GemFire CPPCACHE export.
Definition: gf_base.hpp:51
~DataOutput()
destructor
Definition: DataOutput.hpp:665
void reset()
Reset the internal cursor to the start of the buffer.
Definition: DataOutput.hpp:722
static int32_t getEncodedLength(const wchar_t *value, int32_t length=0, uint32_t *valLength=NULL)
Get the length required to represent a given wide-character string in java modified UTF-8 format...
Definition: DataOutput.hpp:576
#define GF_NEW(v, stmt)
Allocates x and throws OutOfMemoryException if it fails.
Definition: gf_base.hpp:315
void writeBytes(const int8_t *bytes, int32_t len)
Write an array of signed bytes to the DataOutput.
Definition: DataOutput.hpp:129
void writeUTF(const char *value, uint32_t length=0)
Writes the given given string using java modified UTF-8 encoding supporting maximum encoded length of...
Definition: DataOutput.hpp:426
uint32_t getRemainingBufferLength() const
Get a pointer to the internal buffer of DataOutput.
Definition: DataOutput.hpp:683
void writeASCII(const char *value, uint32_t length=0)
Writes the given ASCII string supporting maximum length of 64K (i.e.
Definition: DataOutput.hpp:338
void writeInt(uint32_t value)
Write a 32-bit unsigned integer value to the DataOutput.
Definition: DataOutput.hpp:197
void writeUTF(const wchar_t *value, uint32_t length=0)
Writes the given given string using java modified UTF-8 encoding supporting maximum encoded length of...
Definition: DataOutput.hpp:484

GemFire C++ Cache API Documentation