sábado, 4 de agosto de 2007

Protocolo de serialización de objetos de Java

Documento de especificación: "Object Serialization Stream Protocol".

Terminal symbols and constants:
 final static short STREAM_MAGIC = (short)0xaced;
final static short STREAM_VERSION = 5;
final static byte TC_NULL = (byte)0x70;
final static byte TC_REFERENCE = (byte)0x71;
final static byte TC_CLASSDESC = (byte)0x72;
final static byte TC_OBJECT = (byte)0x73;
final static byte TC_STRING = (byte)0x74;
final static byte TC_ARRAY = (byte)0x75;
final static byte TC_CLASS = (byte)0x76;
final static byte TC_BLOCKDATA = (byte)0x77;
final static byte TC_ENDBLOCKDATA = (byte)0x78;
final static byte TC_RESET = (byte)0x79;
final static byte TC_BLOCKDATALONG = (byte)0x7A;
final static byte TC_EXCEPTION = (byte)0x7B;
final static byte TC_LONGSTRING = (byte) 0x7C;
final static byte TC_PROXYCLASSDESC = (byte) 0x7D;
...


Ej:
"`aced0005`(1) s(2) r(3) `000d`AllPrintString(4) `140a`24`8660a04(5) 02(6) 0009(7)..."
(1) Header identifying the stream.
(2) TC_OBJECT: start new object -> `s = 73
(3) TC_CLASSDESC: start new class def -> r = 72
(4) Name of the class: UTF-8 string
(5) GUID of the class
(6) SC_SERIALIZABLE (class flag)
(7) Number of class members: 9.

Ej:
AC ED 00 05 | 73 72b 00 1D | ...

No hay comentarios: