public class BinarySerializer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.util.List<IDecoderHandler> |
DECODER_HANDLERS
Handlers for decoding.
|
static java.util.List<ITraverseProcessor> |
ENCODER_HANDLERS
Handlers for encoding.
|
protected static java.lang.String |
NULL_MARKER
Marker for null values
|
protected static java.lang.String |
REFERENCE_MARKER
Marker for references
|
Constructor and Description |
---|
BinarySerializer() |
Modifier and Type | Method and Description |
---|---|
protected static java.lang.Object |
decodeObject(IDecodingContext context)
Helper method for decoding an object (used for recursion).
|
protected static java.lang.Object |
decodeRawObject(java.lang.Class<?> clazz,
IDecodingContext context)
Method for decoding a raw object where the class is known.
|
static java.lang.Object |
objectFromByteArray(byte[] val,
java.util.List<IDecoderHandler> postprocessors,
java.lang.Object usercontext,
java.lang.ClassLoader classloader,
IErrorReporter errorreporter)
Convert a byte array to an object.
|
static java.lang.Object |
objectFromByteArrayInputStream(java.io.ByteArrayInputStream bais,
java.util.List<IDecoderHandler> postprocessors,
java.lang.Object usercontext,
java.lang.ClassLoader classloader,
IErrorReporter errorreporter)
Convert a byte array to an object.
|
static byte[] |
objectToByteArray(java.lang.Object val,
java.lang.ClassLoader classloader)
Convert an object to an encoded byte array.
|
static byte[] |
objectToByteArray(java.lang.Object val,
java.util.List<ITraverseProcessor> preprocessors,
java.util.List<ITraverseProcessor> encoderhandlers,
java.lang.Object usercontext,
java.lang.ClassLoader classloader)
Convert an object to an encoded byte array.
|
static byte[] |
objectToByteArray(java.lang.Object val,
java.util.List<ITraverseProcessor> preprocessors,
java.lang.Object usercontext,
java.lang.ClassLoader classloader)
Convert an object to an encoded byte array.
|
protected static final java.lang.String NULL_MARKER
protected static final java.lang.String REFERENCE_MARKER
public static final java.util.List<ITraverseProcessor> ENCODER_HANDLERS
protected static final java.util.List<IDecoderHandler> DECODER_HANDLERS
public static byte[] objectToByteArray(java.lang.Object val, java.lang.ClassLoader classloader)
val
- The object being encoded.preprocessors
- List of processors called before the object is encoded, may be null.usercontext
- A user context, may be null.classloader
- The class loader used.public static byte[] objectToByteArray(java.lang.Object val, java.util.List<ITraverseProcessor> preprocessors, java.lang.Object usercontext, java.lang.ClassLoader classloader)
val
- The object being encoded.preprocessors
- List of processors called before the object is encoded, may be null.usercontext
- A user context, may be null.classloader
- The class loader used.public static byte[] objectToByteArray(java.lang.Object val, java.util.List<ITraverseProcessor> preprocessors, java.util.List<ITraverseProcessor> encoderhandlers, java.lang.Object usercontext, java.lang.ClassLoader classloader)
val
- The object being encoded.preprocessors
- List of processors called before the object is encoded, may be null.usercontext
- A user context, may be null.classloader
- The class loader used.public static java.lang.Object objectFromByteArray(byte[] val, java.util.List<IDecoderHandler> postprocessors, java.lang.Object usercontext, java.lang.ClassLoader classloader, IErrorReporter errorreporter)
val
- The byte array.usercontext
- A user context, may be null.classloader
- The class loader.errorreporter
- The error reporter, may be null in which case the default reporter is used.public static java.lang.Object objectFromByteArrayInputStream(java.io.ByteArrayInputStream bais, java.util.List<IDecoderHandler> postprocessors, java.lang.Object usercontext, java.lang.ClassLoader classloader, IErrorReporter errorreporter)
val
- The byte array.usercontext
- A user context, may be null.classloader
- The class loader.errorreporter
- The error reporter, may be null in which case the default reporter is used.protected static java.lang.Object decodeObject(IDecodingContext context)
context
- The decoding context.protected static java.lang.Object decodeRawObject(java.lang.Class<?> clazz, IDecodingContext context)
clazz
- The object's class.context
- The decoding context.