public class PayloadSerializer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
PayloadSerializer.ArrayHelper<T>
Helper class for scalar classes and their arrays
|
private static class |
PayloadSerializer.Cls<T extends java.io.Externalizable>
Helper class for processing Externalizable FWD classes
|
private static class |
PayloadSerializer.Core<T>
Helper class for processing core Java classes
|
private static class |
PayloadSerializer.Helper<T>
Helper class for different types of payload components
|
private static class |
PayloadSerializer.Primitive<T>
Helper classes for primitive arrays
|
Modifier and Type | Field and Description |
---|---|
private static short |
ARRAY |
private static short |
CORE_ARRAY |
private static java.util.Map<java.lang.Class<?>,PayloadSerializer.Core<?>> |
CORE_BY_CLASS
Helper classes for core Java classes by class
|
private static PayloadSerializer.Core<?>[] |
CORE_BY_TYPECODE
Helper classes for core Java classes by typecode
|
private static short |
NULL
Special type codes
|
private static short |
OBJECT |
private static java.util.List<PayloadSerializer.Cls<?>> |
PAYLOAD_CLASSES
Helper classes for FWD classes
|
private static java.util.Map<java.lang.Class<?>,PayloadSerializer.Cls<?>> |
PAYLOAD_CLASSES_BY_CLASS
Helper classes for FWD classes by class
|
private static PayloadSerializer.Cls[] |
PAYLOAD_CLASSES_BY_TYPECODE
Helper classes for FWD classes by typecode
|
private static java.util.List<PayloadSerializer.Core<?>> |
PAYLOAD_CORE
Helper classes for core Java classes
|
private static java.util.List<PayloadSerializer.Primitive<?>> |
PAYLOAD_PRIMITIVES
Helper classes for primitive arrays
|
private static short |
PRIMITIVE_ARRAY |
private static java.util.Map<java.lang.Class<?>,PayloadSerializer.Primitive<?>> |
PRIMITIVES_BY_CLASS
Helper classes for primitive arrays by array class
|
private static PayloadSerializer.Primitive<?>[] |
PRIMITIVES_BY_TYPECODE
Helper classes for primitive arrays by typecode
|
private static boolean |
USE_PAYLOAD_SERIALIZER
"use payload serializer" flag
|
Constructor and Description |
---|
PayloadSerializer() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
dumpObject(java.lang.Object o)
Dump generic object can be array with array member to the string
|
static void |
main(java.lang.String... args)
Test program
|
private static java.util.List<java.lang.Object> |
randomData(java.util.Random rnd,
int len,
int depth)
Generate random payload
|
private static java.io.Serializable |
readArray(java.io.ObjectInput in)
Read array from the input stream
|
private static java.io.Serializable |
readCoreArray(java.io.ObjectInput in)
Read array of core Java classes from the input stream
|
private static java.io.Serializable |
readItem(java.io.ObjectInput in,
short type)
Read scalar object from the input stream
|
static java.io.Serializable |
readPayload(java.io.ObjectInput in)
Read Message payload from the input stream
|
private static java.io.Serializable |
readPrimitiveArray(java.io.ObjectInput in)
Read primitive array from the input stream
|
private static int |
test(boolean print,
int len) |
private static void |
writeArray(java.io.ObjectOutput out,
java.lang.Object o,
java.lang.Class<?> c)
Write array to the output stream
|
private static void |
writeCoreArray(java.io.ObjectOutput out,
java.lang.Object o,
PayloadSerializer.Core<?> core)
Write array of core Java classes to the output stream
|
private static void |
writeItem(java.io.ObjectOutput out,
java.lang.Object o)
Write scalar object to the output stream
|
static void |
writePayload(java.io.ObjectOutput out,
java.lang.Object o)
Write Message payload to the output stream
|
private static void |
writePrimitiveArray(java.io.ObjectOutput out,
java.lang.Object o)
Write primitive array to the output stream
|
private static final boolean USE_PAYLOAD_SERIALIZER
private static final short NULL
private static final short OBJECT
private static final short ARRAY
private static final short PRIMITIVE_ARRAY
private static final short CORE_ARRAY
private static final java.util.List<PayloadSerializer.Primitive<?>> PAYLOAD_PRIMITIVES
private static final java.util.Map<java.lang.Class<?>,PayloadSerializer.Primitive<?>> PRIMITIVES_BY_CLASS
private static final PayloadSerializer.Primitive<?>[] PRIMITIVES_BY_TYPECODE
private static final java.util.List<PayloadSerializer.Core<?>> PAYLOAD_CORE
private static final java.util.Map<java.lang.Class<?>,PayloadSerializer.Core<?>> CORE_BY_CLASS
private static final PayloadSerializer.Core<?>[] CORE_BY_TYPECODE
private static final java.util.List<PayloadSerializer.Cls<?>> PAYLOAD_CLASSES
private static final java.util.Map<java.lang.Class<?>,PayloadSerializer.Cls<?>> PAYLOAD_CLASSES_BY_CLASS
private static final PayloadSerializer.Cls[] PAYLOAD_CLASSES_BY_TYPECODE
public static java.lang.String dumpObject(java.lang.Object o)
o
- object to be renderedpublic static java.io.Serializable readPayload(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
in
- input streamjava.io.IOException
- In case of I/O errorjava.lang.ClassNotFoundException
- If class is not foundpublic static void writePayload(java.io.ObjectOutput out, java.lang.Object o) throws java.io.IOException
out
- output streamo
- payload to be writtenjava.io.IOException
- In case of I/O errorprivate static java.io.Serializable readCoreArray(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
in
- input streamjava.io.IOException
- In case of I/O errorjava.lang.ClassNotFoundException
- If class is not foundprivate static void writeCoreArray(java.io.ObjectOutput out, java.lang.Object o, PayloadSerializer.Core<?> core) throws java.io.IOException
out
- output streamo
- array to be writtencore
- helper for the array component classjava.io.IOException
- In case of I/O errorprivate static java.io.Serializable readArray(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
in
- input streamjava.io.IOException
- In case of I/O errorjava.lang.ClassNotFoundException
- If class is not foundprivate static void writeArray(java.io.ObjectOutput out, java.lang.Object o, java.lang.Class<?> c) throws java.io.IOException
out
- output streamo
- array to be writtenc
- type of the array componentjava.io.IOException
- In case of I/O errorprivate static java.io.Serializable readPrimitiveArray(java.io.ObjectInput in) throws java.io.IOException
in
- input streamjava.io.IOException
- In case of I/O errorprivate static void writePrimitiveArray(java.io.ObjectOutput out, java.lang.Object o) throws java.io.IOException
out
- output streamo
- array to be writtenjava.io.IOException
- In case of I/O errorprivate static java.io.Serializable readItem(java.io.ObjectInput in, short type) throws java.lang.ClassNotFoundException, java.io.IOException
in
- input streamtype
- object typecodejava.lang.ClassNotFoundException
- If class is not foundjava.io.IOException
- In case of I/O errorprivate static void writeItem(java.io.ObjectOutput out, java.lang.Object o) throws java.io.IOException
out
- output streamo
- object to be writtenjava.io.IOException
- In case of I/O errorpublic static void main(java.lang.String... args) throws java.lang.Exception
args
- command line argsjava.lang.Exception
- In case of runtime errorprivate static int test(boolean print, int len) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
private static java.util.List<java.lang.Object> randomData(java.util.Random rnd, int len, int depth)
rnd
- random generatorlen
- list lengthdepth
- depth of the recursion (array as members of array)