VMware GemFire Native C++ Reference  9.1
DataOutput.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef GEODE_DATAOUTPUT_H_
4 #define GEODE_DATAOUTPUT_H_
5 
6 /*
7  * Licensed to the Apache Software Foundation (ASF) under one or more
8  * contributor license agreements. See the NOTICE file distributed with
9  * this work for additional information regarding copyright ownership.
10  * The ASF licenses this file to You under the Apache License, Version 2.0
11  * (the "License"); you may not use this file except in compliance with
12  * the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 
23 #include "geode_globals.hpp"
24 #include "ExceptionTypes.hpp"
25 #include "Log.hpp"
26 #include "Serializable.hpp"
27 #include "CacheableString.hpp"
28 
29 #include <cstring>
30 #include <string>
31 #include <cstdlib>
32 
37 namespace apache {
38 namespace geode {
39 namespace client {
40 
45 #define GF_ALLOC(v, t, s) \
46  { \
47  v = (t*)malloc((s) * sizeof(t)); \
48  if ((v) == NULL) { \
49  throw OutOfMemoryException( \
50  "Out of Memory while allocating buffer for " #t " of size " #s); \
51  } \
52  }
53 
58 #define GF_RESIZE(v, t, s) \
59  { \
60  v = (t*)realloc(v, (s) * sizeof(t)); \
61  if ((v) == NULL) { \
62  throw OutOfMemoryException( \
63  "Out of Memory while resizing buffer for " #t); \
64  } \
65  }
66 
67 #define GF_FREE(v) free(v)
68 
75  public:
79  DataOutput();
80 
86  inline void write(uint8_t value) {
87  ensureCapacity(1);
88  writeNoCheck(value);
89  }
90 
96  inline void write(int8_t value) { write(static_cast<uint8_t>(value)); }
97 
103  inline void writeBoolean(bool value) { write(static_cast<uint8_t>(value)); }
104 
111  inline void writeBytes(const uint8_t* bytes, int32_t len) {
112  if (len >= 0) {
113  ensureCapacity(len + 5);
114  writeArrayLen(bytes == NULL ? 0 : len); // length of bytes...
115  if (len > 0 && bytes != NULL) {
116  std::memcpy(m_buf, bytes, len);
117  m_buf += len;
118  }
119  } else {
120  write(static_cast<int8_t>(-1));
121  }
122  }
123 
130  inline void writeBytes(const int8_t* bytes, int32_t len) {
131  writeBytes(reinterpret_cast<const uint8_t*>(bytes), len);
132  }
133 
145  inline void writeBytesOnly(const uint8_t* bytes, uint32_t len) {
146  ensureCapacity(len);
147  std::memcpy(m_buf, bytes, len);
148  m_buf += len;
149  }
150 
162  inline void writeBytesOnly(const int8_t* bytes, uint32_t len) {
163  writeBytesOnly(reinterpret_cast<const uint8_t*>(bytes), len);
164  }
165 
171  inline void writeInt(uint16_t value) {
172  ensureCapacity(2);
173  *(m_buf++) = static_cast<uint8_t>(value >> 8);
174  *(m_buf++) = static_cast<uint8_t>(value);
175  }
176 
182  inline void writeChar(uint16_t value) {
183  ensureCapacity(2);
184  *(m_buf++) = static_cast<uint8_t>(value >> 8);
185  *(m_buf++) = static_cast<uint8_t>(value);
186  }
187 
193  inline void writeInt(uint32_t value) {
194  ensureCapacity(4);
195  *(m_buf++) = static_cast<uint8_t>(value >> 24);
196  *(m_buf++) = static_cast<uint8_t>(value >> 16);
197  *(m_buf++) = static_cast<uint8_t>(value >> 8);
198  *(m_buf++) = static_cast<uint8_t>(value);
199  }
200 
206  inline void writeInt(uint64_t value) {
207  ensureCapacity(8);
208  // the defines are not reliable and can be changed by compiler options.
209  // Hence using sizeof() test instead.
210  //#if defined(_LP64) || ( defined(__WORDSIZE) && __WORDSIZE == 64 ) ||
211  //( defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64 )
212  if (sizeof(long) == 8) {
213  *(m_buf++) = static_cast<uint8_t>(value >> 56);
214  *(m_buf++) = static_cast<uint8_t>(value >> 48);
215  *(m_buf++) = static_cast<uint8_t>(value >> 40);
216  *(m_buf++) = static_cast<uint8_t>(value >> 32);
217  *(m_buf++) = static_cast<uint8_t>(value >> 24);
218  *(m_buf++) = static_cast<uint8_t>(value >> 16);
219  *(m_buf++) = static_cast<uint8_t>(value >> 8);
220  *(m_buf++) = static_cast<uint8_t>(value);
221  } else {
222  uint32_t hword = static_cast<uint32_t>(value >> 32);
223  *(m_buf++) = static_cast<uint8_t>(hword >> 24);
224  *(m_buf++) = static_cast<uint8_t>(hword >> 16);
225  *(m_buf++) = static_cast<uint8_t>(hword >> 8);
226  *(m_buf++) = static_cast<uint8_t>(hword);
227 
228  hword = static_cast<uint32_t>(value);
229  *(m_buf++) = static_cast<uint8_t>(hword >> 24);
230  *(m_buf++) = static_cast<uint8_t>(hword >> 16);
231  *(m_buf++) = static_cast<uint8_t>(hword >> 8);
232  *(m_buf++) = static_cast<uint8_t>(hword);
233  }
234  }
235 
241  inline void writeInt(int16_t value) {
242  writeInt(static_cast<uint16_t>(value));
243  }
244 
250  inline void writeInt(int32_t value) {
251  writeInt(static_cast<uint32_t>(value));
252  }
253 
259  inline void writeInt(int64_t value) {
260  writeInt(static_cast<uint64_t>(value));
261  }
262 
270  inline void writeArrayLen(int32_t len) {
271  if (len == -1) {
272  write(static_cast<int8_t>(-1));
273  } else if (len <= 252) { // 252 is java's ((byte)-4 && 0xFF)
274  write(static_cast<uint8_t>(len));
275  } else if (len <= 0xFFFF) {
276  write(static_cast<int8_t>(-2));
277  writeInt(static_cast<uint16_t>(len));
278  } else {
279  write(static_cast<int8_t>(-3));
280  writeInt(len);
281  }
282  }
283 
289  inline void writeFloat(float value) {
290  union float_uint32_t {
291  float f;
292  uint32_t u;
293  } v;
294  v.f = value;
295  writeInt(v.u);
296  }
297 
303  inline void writeDouble(double value) {
304  union double_uint64_t {
305  double d;
306  uint64_t ll;
307  } v;
308  v.d = value;
309  writeInt(v.ll);
310  }
311 
324  inline void writeASCII(const char* value, uint32_t length = 0) {
325  if (value != NULL) {
326  if (length == 0) {
327  length = static_cast<uint32_t>(strlen(value));
328  }
329  uint16_t len = static_cast<uint16_t>(length > 0xFFFF ? 0xFFFF : length);
330  writeInt(len);
331  writeBytesOnly((int8_t*)value, len); // K64
332  } else {
333  writeInt(static_cast<uint16_t>(0));
334  }
335  }
336 
337  inline void writeNativeString(const char* value) {
338  // create cacheable string
339  // write typeid id.
340  // call todata
342  write(csPtr->typeId());
343  csPtr->toData(*this);
344  }
345 
357  inline void writeASCIIHuge(const char* value, uint32_t length = 0) {
358  if (value != NULL) {
359  if (length == 0) {
360  length = static_cast<uint32_t>(strlen(value));
361  }
362  writeInt(length);
363  writeBytesOnly((int8_t*)value, length);
364  } else {
365  writeInt(static_cast<uint32_t>(0));
366  }
367  }
368 
379  inline void writeFullUTF(const char* value, uint32_t length = 0) {
380  if (value != NULL) {
381  int32_t encodedLen = getEncodedLength(value, length);
382  writeInt(encodedLen);
383  ensureCapacity(encodedLen);
384  write(static_cast<int8_t>(0)); // isObject = 0 BYTE_CODE
385  uint8_t* end = m_buf + encodedLen;
386  while (m_buf < end) {
387  encodeChar(*value++);
388  }
389  if (m_buf > end) m_buf = end;
390  } else {
391  writeInt(static_cast<uint16_t>(0));
392  }
393  }
394 
406  inline void writeUTF(const char* value, uint32_t length = 0) {
407  if (value != NULL) {
408  int32_t len = getEncodedLength(value, length);
409  uint16_t encodedLen = static_cast<uint16_t>(len > 0xFFFF ? 0xFFFF : len);
410  writeInt(encodedLen);
411  ensureCapacity(encodedLen);
412  uint8_t* end = m_buf + encodedLen;
413  while (m_buf < end) {
414  encodeChar(*value++);
415  }
416  if (m_buf > end) m_buf = end;
417  } else {
418  writeInt(static_cast<uint16_t>(0));
419  }
420  }
421 
434  inline void writeUTFHuge(const char* value, uint32_t length = 0) {
435  if (value != NULL) {
436  if (length == 0) {
437  length = static_cast<uint32_t>(strlen(value));
438  }
439  writeInt(length);
440  ensureCapacity(length * 2);
441  for (uint32_t pos = 0; pos < length; pos++) {
442  writeNoCheck(static_cast<int8_t>(0));
443  writeNoCheck(static_cast<int8_t>(value[pos]));
444  }
445  } else {
446  writeInt(static_cast<uint32_t>(0));
447  }
448  }
449 
461  inline void writeUTF(const wchar_t* value, uint32_t length = 0) {
462  if (value != NULL) {
463  int32_t len = getEncodedLength(value, length);
464  uint16_t encodedLen = static_cast<uint16_t>(len > 0xFFFF ? 0xFFFF : len);
465  writeInt(encodedLen);
466  ensureCapacity(encodedLen);
467  uint8_t* end = m_buf + encodedLen;
468  while (m_buf < end) {
469  encodeChar(*value++);
470  }
471  if (m_buf > end) m_buf = end;
472  } else {
473  writeInt(static_cast<uint16_t>(0));
474  }
475  }
476 
487  inline void writeUTFHuge(const wchar_t* value, uint32_t length = 0) {
488  if (value != NULL) {
489  if (length == 0) {
490  length = static_cast<uint32_t>(wcslen(value));
491  }
492  writeInt(length);
493  ensureCapacity(length * 2);
494  for (uint32_t pos = 0; pos < length; pos++) {
495  uint16_t item = static_cast<uint16_t>(value[pos]);
496  writeNoCheck(static_cast<uint8_t>((item & 0xFF00) >> 8));
497  writeNoCheck(static_cast<uint8_t>(item & 0xFF));
498  }
499  } else {
500  writeInt(static_cast<uint32_t>(0));
501  }
502  }
503 
514  inline static int32_t getEncodedLength(const char* value, int32_t length = 0,
515  uint32_t* valLength = NULL) {
516  if (value == NULL) return 0;
517  char currentChar;
518  int32_t encodedLen = 0;
519  const char* start = value;
520  if (length == 0) {
521  while ((currentChar = *value) != '\0') {
522  getEncodedLength(currentChar, encodedLen);
523  value++;
524  }
525  } else {
526  const char* end = value + length;
527  while (value < end) {
528  currentChar = *value;
529  getEncodedLength(currentChar, encodedLen);
530  value++;
531  }
532  }
533  if (valLength != NULL) {
534  *valLength = static_cast<uint32_t>(value - start);
535  }
536  return encodedLen;
537  }
538 
549  inline static int32_t getEncodedLength(const wchar_t* value,
550  int32_t length = 0,
551  uint32_t* valLength = NULL) {
552  if (value == NULL) return 0;
553  wchar_t currentChar;
554  int32_t encodedLen = 0;
555  const wchar_t* start = value;
556  if (length == 0) {
557  while ((currentChar = *value) != 0) {
558  getEncodedLength(currentChar, encodedLen);
559  value++;
560  }
561  } else {
562  const wchar_t* end = value + length;
563  while (value < end) {
564  currentChar = *value;
565  getEncodedLength(currentChar, encodedLen);
566  value++;
567  }
568  }
569  if (valLength != NULL) {
570  *valLength = static_cast<uint32_t>(value - start);
571  }
572  return encodedLen;
573  }
574 
581  template <class PTR>
582  void writeObject(const SharedPtr<PTR>& objptr, bool isDelta = false) {
583  writeObjectInternal(objptr.ptr(), isDelta);
584  }
585 
592  void writeObject(const Serializable* objptr) { writeObjectInternal(objptr); }
593 
598  const uint8_t* getCursor() { return m_buf; }
599 
605  void advanceCursor(uint32_t offset) {
606  ensureCapacity(offset);
607  m_buf += offset;
608  }
609 
615  void rewindCursor(uint32_t offset) { m_buf -= offset; }
616 
617  void updateValueAtPos(uint32_t offset, uint8_t value) {
618  m_bytes[offset] = value;
619  }
620 
621  uint8_t getValueAtPos(uint32_t offset) { return m_bytes[offset]; }
624  reset();
625  DataOutput::checkinBuffer(m_bytes, m_size);
626  }
627 
631  inline const uint8_t* getBuffer() const {
632  // GF_R_ASSERT(!((uint32_t)(m_bytes) % 4));
633  return m_bytes;
634  }
635 
639  inline uint32_t getRemainingBufferLength() const {
640  // GF_R_ASSERT(!((uint32_t)(m_bytes) % 4));
641  return m_size - getBufferLength();
642  }
643 
650  inline const uint8_t* getBuffer(uint32_t* rsize) const {
651  *rsize = static_cast<uint32_t>(m_buf - m_bytes);
652  // GF_R_ASSERT(!((uint32_t)(m_bytes) % 4));
653  return m_bytes;
654  }
655 
656  inline uint8_t* getBufferCopy() {
657  uint32_t size = static_cast<uint32_t>(m_buf - m_bytes);
658  uint8_t* result;
659  GF_ALLOC(result, uint8_t, size);
660  std::memcpy(result, m_bytes, size);
661  return result;
662  }
663 
668  inline uint32_t getBufferLength() const {
669  return static_cast<uint32_t>(m_buf - m_bytes);
670  }
671 
675  inline void reset() {
676  if (m_haveBigBuffer) {
677  // free existing buffer
678  GF_FREE(m_bytes);
679  // create smaller buffer
680  GF_ALLOC(m_bytes, uint8_t, m_lowWaterMark);
681  m_size = m_lowWaterMark;
682  // reset the flag
683  m_haveBigBuffer = false;
684  // release the lock
685  releaseLock();
686  }
687  m_buf = m_bytes;
688  }
689 
690  // make sure there is room left for the requested size item.
691  inline void ensureCapacity(uint32_t size) {
692  uint32_t offset = static_cast<uint32_t>(m_buf - m_bytes);
693  if ((m_size - offset) < size) {
694  uint32_t newSize = m_size * 2 + (8192 * (size / 8192));
695  if (newSize >= m_highWaterMark && !m_haveBigBuffer) {
696  // acquire the lock
697  acquireLock();
698  // set flag
699  m_haveBigBuffer = true;
700  }
701  m_size = newSize;
702  GF_RESIZE(m_bytes, uint8_t, m_size);
703  m_buf = m_bytes + offset;
704  }
705  }
706 
707  /*
708  * This is for internal use
709  */
710  const char* getPoolName() { return m_poolName; }
711 
712  /*
713  * This is for internal use
714  */
715  void setPoolName(const char* poolName) { m_poolName = poolName; }
716 
717  uint8_t* getBufferCopyFrom(const uint8_t* from, uint32_t length) {
718  uint8_t* result;
719  GF_NEW(result, uint8_t[length]);
720  std::memcpy(result, from, length);
721 
722  return result;
723  }
724 
725  static void safeDelete(uint8_t* src) { GF_SAFE_DELETE(src); }
726 
727  static DataOutput* getDataOutput() { return new DataOutput(); }
728  static void releaseDataOutput(DataOutput* dataOutput) {
729  GF_SAFE_DELETE(dataOutput);
730  }
731 
732  private:
733  void writeObjectInternal(const Serializable* ptr, bool isDelta = false);
734 
735  static void acquireLock();
736  static void releaseLock();
737 
738  const char* m_poolName;
739  // memory m_buffer to encode to.
740  uint8_t* m_bytes;
741  // cursor.
742  uint8_t* m_buf;
743  // size of m_bytes.
744  uint32_t m_size;
745  // high and low water marks for buffer size
746  static uint32_t m_lowWaterMark;
747  static uint32_t m_highWaterMark;
748  // flag to indicate we have a big buffer
749  volatile bool m_haveBigBuffer;
750 
751  inline static void getEncodedLength(const char val, int32_t& encodedLen) {
752  if ((val == 0) || (val & 0x80)) {
753  // two byte.
754  encodedLen += 2;
755  } else {
756  // one byte.
757  encodedLen++;
758  }
759  }
760 
761  inline static void getEncodedLength(const wchar_t val, int32_t& encodedLen) {
762  if (val == 0) {
763  encodedLen += 2;
764  } else if (val < 0x80) // ASCII character
765  {
766  encodedLen++;
767  } else if (val < 0x800) {
768  encodedLen += 2;
769  } else {
770  encodedLen += 3;
771  }
772  }
773 
774  inline void encodeChar(const char value) {
775  uint8_t tmp = static_cast<uint8_t>(value);
776  if ((tmp == 0) || (tmp & 0x80)) {
777  // two byte.
778  *(m_buf++) = static_cast<uint8_t>(0xc0 | ((tmp & 0xc0) >> 6));
779  *(m_buf++) = static_cast<uint8_t>(0x80 | (tmp & 0x3f));
780  } else {
781  // one byte.
782  *(m_buf++) = tmp;
783  }
784  }
785 
786  // this will lose the character set encoding.
787  inline void encodeChar(const wchar_t value) {
788  uint16_t c = static_cast<uint16_t>(value);
789  if (c == 0) {
790  *(m_buf++) = 0xc0;
791  *(m_buf++) = 0x80;
792  } else if (c < 0x80) { // ASCII character
793  *(m_buf++) = static_cast<uint8_t>(c);
794  } else if (c < 0x800) {
795  *(m_buf++) = static_cast<uint8_t>(0xC0 | c >> 6);
796  *(m_buf++) = static_cast<uint8_t>(0x80 | (c & 0x3F));
797  } else {
798  *(m_buf++) = static_cast<uint8_t>(0xE0 | c >> 12);
799  *(m_buf++) = static_cast<uint8_t>(0x80 | ((c >> 6) & 0x3F));
800  *(m_buf++) = static_cast<uint8_t>(0x80 | (c & 0x3F));
801  }
802  }
803 
804  inline void writeNoCheck(uint8_t value) { *(m_buf++) = value; }
805 
806  inline void writeNoCheck(int8_t value) {
807  writeNoCheck(static_cast<uint8_t>(value));
808  }
809 
810  static uint8_t* checkoutBuffer(uint32_t* size);
811  static void checkinBuffer(uint8_t* buffer, uint32_t size);
812 
813  // disable copy constructor and assignment
814  DataOutput(const DataOutput&);
815  DataOutput& operator=(const DataOutput&);
816 };
817 } // namespace client
818 } // namespace geode
819 } // namespace apache
820 
821 #endif // GEODE_DATAOUTPUT_H_
void writeBytes(const int8_t *bytes, int32_t len)
Write an array of signed bytes to the DataOutput.
Definition: DataOutput.hpp:130
void writeChar(uint16_t value)
Write a 16-bit Char (wchar_t) value to the DataOutput.
Definition: DataOutput.hpp:182
const uint8_t * getCursor()
Get an internal pointer to the current location in the DataOutput byte array.
Definition: DataOutput.hpp:598
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:270
void writeUTFHuge(const wchar_t *value, uint32_t length=0)
Writes the given string using java modified UTF-8 encoding.
Definition: DataOutput.hpp:487
void writeInt(int32_t value)
Write a 32-bit signed integer value to the DataOutput.
Definition: DataOutput.hpp:250
#define GF_SAFE_DELETE(x)
Deletes x only if it exists.
Definition: geode_base.hpp:304
void writeFloat(float value)
Write a float value to the DataOutput.
Definition: DataOutput.hpp:289
void writeUTFHuge(const char *value, uint32_t length=0)
Writes the given string using java modified UTF-8 encoding.
Definition: DataOutput.hpp:434
Each enum represents a predefined RegionAttributes in a Cache.
Definition: Assert.hpp:31
void writeASCII(const char *value, uint32_t length=0)
Writes the given ASCII string supporting maximum length of 64K (i.e.
Definition: DataOutput.hpp:324
void write(int8_t value)
Write a signed byte to the DataOutput.
Definition: DataOutput.hpp:96
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:113
void writeASCIIHuge(const char *value, uint32_t length=0)
Writes the given ASCII string supporting upto maximum 32-bit integer value.
Definition: DataOutput.hpp:357
uint32_t getBufferLength() const
Get the length of current data in the internal buffer of DataOutput.
Definition: DataOutput.hpp:668
void reset()
Reset the internal cursor to the start of the buffer.
Definition: DataOutput.hpp:675
void writeInt(uint64_t value)
Write a 64-bit unsigned integer value to the DataOutput.
Definition: DataOutput.hpp:206
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:549
void writeBoolean(bool value)
Write a boolean value to the DataOutput.
Definition: DataOutput.hpp:103
#define CPPCACHE_EXPORT
Defines a Geode CPPCACHE export.
Definition: geode_base.hpp:58
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
uint32_t getRemainingBufferLength() const
Get a pointer to the internal buffer of DataOutput.
Definition: DataOutput.hpp:639
virtual void toData(DataOutput &output) const
serialize this object
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:514
void writeObject(const Serializable *objptr)
Write a Serializable object to the DataOutput.
Definition: DataOutput.hpp:592
Provide operations for writing primitive data values, byte arrays, strings, Serializable objects to a...
Definition: DataOutput.hpp:74
void writeInt(int16_t value)
Write a 16-bit signed integer value to the DataOutput.
Definition: DataOutput.hpp:241
void writeObject(const SharedPtr< PTR > &objptr, bool isDelta=false)
Write a Serializable object to the DataOutput.
Definition: DataOutput.hpp:582
void writeInt(uint32_t value)
Write a 32-bit unsigned integer value to the DataOutput.
Definition: DataOutput.hpp:193
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:461
This abstract base class is the superclass of all user objects in the cache that can be serialized...
Definition: Serializable.hpp:53
const uint8_t * getBuffer() const
Get a pointer to the internal buffer of DataOutput.
Definition: DataOutput.hpp:631
void writeBytes(const uint8_t *bytes, int32_t len)
Write an array of unsigned bytes to the DataOutput.
Definition: DataOutput.hpp:111
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:379
void writeInt(int64_t value)
Write a 64-bit signed integer value to the DataOutput.
Definition: DataOutput.hpp:259
virtual int8_t typeId() const
Return the typeId byte of the instance being serialized.
void advanceCursor(uint32_t offset)
Advance the buffer cursor by the given offset.
Definition: DataOutput.hpp:605
const uint8_t * getBuffer(uint32_t *rsize) const
Get a pointer to the internal buffer of DataOutput.
Definition: DataOutput.hpp:650
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:406
~DataOutput()
Destruct a DataOutput, including releasing the created buffer.
Definition: DataOutput.hpp:623
void writeInt(uint16_t value)
Write a 16-bit unsigned integer value to the DataOutput.
Definition: DataOutput.hpp:171
void rewindCursor(uint32_t offset)
Rewind the buffer cursor by the given offset.
Definition: DataOutput.hpp:615
void writeDouble(double value)
Write a double precision real number to the DataOutput.
Definition: DataOutput.hpp:303
#define GF_NEW(v, stmt)
Allocates x and throws OutOfMemoryException if it fails.
Definition: geode_base.hpp:293
#define GF_ALLOC(v, t, s)
C style memory allocation that throws OutOfMemoryException if it fails.
Definition: DataOutput.hpp:45
void write(uint8_t value)
Write an unsigned byte to the DataOutput.
Definition: DataOutput.hpp:86
#define GF_RESIZE(v, t, s)
C style memory re-allocation that throws OutOfMemoryException if it fails.
Definition: DataOutput.hpp:58
void writeBytesOnly(const int8_t *bytes, uint32_t len)
Write an array of signed bytes without its length to the DataOutput.
Definition: DataOutput.hpp:162
This namespace contains all the Geode C++ API classes, enumerations and globals.

Pivotal GemFire C++ Cache API Documentation