Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In Geode, every supported data type is associated with type Id. Type Id is represented by one byte. To serialize any date type Geode first writes the typeId. Then it writes the length of serialized byte for variable types. For fixed data types it just writes those bytes in the Big Indian byte order.

 

Data TypeGeode Region Key TypesType IdValueSerialized BytesDescription
Null 41 = 0x29null
typeId0x29
 
Boolean YES53 = 0x35true
typeId0x35
bytes0x01
 
Character YES54 = 0x36'a'
typeId0x36
bytes

0x00 0x61

 
Byte YES55 = 0x371
typeId0x37
bytes0x01
 
Short YES56 = 0x381000
typeId0x38
bytes0x03 0xE8
 
Integer YES57 = 0x391000
typeId0x39
bytes0x00 0x00 0x03 0xE8
 
Long YES58 = 0x3A1000
typeId0x3A
bytes0x00 0x00 0x00 0x00 0x00 0x00 0x03 0xE8
 
Float YES59 = 0x3B1000f
typeId0x3B
bytes

0x44 0x7A 0x00 0x00

 
Double YES60 = 0x3C1000d



typeId0x3C
bytes

0x40 0xF1 0x40 0x00 0x00 0x00 0x00 0x00

 
ASCII_STRINGYES87 = 0x57"hello"
typeid0x57
len0x00 0x05
bytes0x68 0x65 0x40 0x40 0x6F
This represents ASCII string with maximum length 0xFFFF. Code snippet to serialize and deserialize the string.
UTF_STRING YES42 = 0x2A  This represents UTF string with maximum length 0xFFFF. Code snippet to serialize and deserialize the string.
HUGE_ASCII_STRING YES88 = 0x58  This represents ASCII string with length greater than 0xFFFF. Code snippet to serialize and deserialize the string.
HUGE_UTF_STRING YES89 = 0x59  This represents UTF string with length greater than 0xFFFF. Code snippet to serialize and deserialize the string.
byte[] YES (This we plan to support)46 = 0x2Ebyte[] {1,2}
typeId0x2E
len0x02
bytes0x01 0x02
 
short[] 47 = 0x2Fshort[] {1,2}
typeId0x2F
len 0x02
bytes

0x00 0x01 0x00 0x02

 
int[] 48 = 0x30int[] {1,2}
typeId0x30
len 0x02
bytes

0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x02

 
long[] 49 = 0x31long[] {1}
typeId0x31
len 0x01
bytes

0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01

 
float[] 50 = 0x32float[] {2.0f}
typeId0x32
len 0x01
bytes

0x40 0x00 0x00 0x00

 
double[] 51 = 0x33double[] {2.0d}
typeId0x33
len0x01
bytes

0x40 0x00 0x00 0x00 0x00 0x00 0x00 0x00

 
string[] 64 = 0x40 String[]{"hello", "world"}
typeId0x40
len 0x02

"hello"

bytes

0x57 - ASCII_STRING

0x00 0x05

0x68 0x65 0x6c 0x6c 0x6f

 

"world"

bytes

0x57 -  ASCII_STRING

0x00 0x05 - len

0x77 0x6f 0x72 0x6c 0x64


 
Map 67 = 0x43

Map s = new HashMap<>();

 s.put("hello", "world")

typeId0x43
len 0x01

"hello"

bytes

0x57 - ASCII_STRING

0x00 0x05

0x68 0x65 0x6c 0x6c 0x6f

 

"world"

bytes

0x57 -  ASCII_STRING

0x00 0x05 - len

0x77 0x6f 0x72 0x6c 0x64

 
Set 66 = 0x42

Set s = new HashSet();

 s.add("hello");

s.add("world");


typeId0x42
len 0x02

"hello"

bytes

0x57 - ASCII_STRING

0x00 0x05

0x68 0x65 0x6c 0x6c 0x6f

"world"

bytes

0x57 -  ASCII_STRING

0x00 0x05 - len

0x77 0x6f 0x72 0x6c 0x64

 
List 10 = 0x0a

List s = new LinkedList();
s.add("hello");
s.add("world");

typeId0x0a
len 0x02

"hello"

bytes

0x57 - ASCII_STRING

0x00 0x05

0x68 0x65 0x6c 0x6c 0x6f

"world"

bytes

0x57 -  ASCII_STRING

0x00 0x05 - len

0x77 0x6f 0x72 0x6c 0x64

 
ArrayList 65=0x41

List s = new ArrayList();
s.add("hello");
s.add("world");

typeId0x41
len 0x02

"hello"

bytes

0x57 - ASCII_STRING

0x00 0x05

0x68 0x65 0x6c 0x6c 0x6f

"world"

bytes

0x57 -  ASCII_STRING

0x00 0x05 - len

0x77 0x6f 0x72 0x6c 0x64

 
PDX_SERIALIZATION 93=0x5D  Java Object can implement PdxSerializable interface to serialize data in pdx format
PDX_SERIALIZER    

The application can implement PdxSerializer interface and then install with geode cache

to serialize data in pdx format.

DATA_SERIALIZATION     Java Object can implement DataSerializable interface to serialize data.
USER_SERIALIZATION     

The application can implement DataSerializer interface and then install with geode cache

to serialize data.

 

Key Data Types

Geode supports data types for the Region Keys. 

 

Calculate Collection/Array Size

...