public final class Marshalled<T> extends Object
IOUtil.objectToBytes(Object)
and
IOUtil.writeObject(DataOutput, Object)
methods understand this object and use the result of
getBytes()
invocation.Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
static <T> Marshalled<T> |
forBytes(byte[] bytes) |
static <T> Marshalled<T> |
forObject(T object) |
byte[] |
getBytes()
Returns byte array representation of this marshalled object.
|
T |
getObject()
Returns object representation of this marshalled object.
|
T |
getObject(ClassLoader cl)
Returns object representation of this marshalled object.
|
int |
hashCode() |
String |
toString() |
static Object |
unwrap(Object object)
Unwraps
Marshalled argument via getObject() call or returns object unmodified. |
public static Object unwrap(Object object)
Marshalled
argument via getObject()
call or returns object unmodified.public static <T> Marshalled<T> forObject(T object)
public static <T> Marshalled<T> forBytes(byte[] bytes)
public T getObject()
MarshallingException
- if object cannot be deserialized from its byte arraypublic T getObject(ClassLoader cl)
cl
- the ClassLoader that will be used to load classes; null
for defaultMarshallingException
- if object cannot be deserialized from its byte arraypublic byte[] getBytes()
MarshallingException
- if object cannot be serialized to byte arrayCopyright © 2014 Devexperts. All Rights Reserved.