public class BinaryMarshaller extends AbstractMarshaller
Marshaller that lets to serialize and deserialize all objects
in the binary format.ctx, DFLT_BUFFER_SIZE| Constructor and Description |
|---|
BinaryMarshaller() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
available()
Checks whether
BinaryMarshaller is able to work on the current JVM. |
MarshallerContext |
getContext()
Returns currently set
MarshallerContext. |
byte[] |
marshal(Object obj)
Marshals object to byte array.
|
void |
marshal(Object obj,
OutputStream out)
Marshals object to the output stream.
|
void |
onUndeploy(ClassLoader ldr)
Undeployment callback invoked when class loader is being undeployed.
|
<T> T |
unmarshal(byte[] bytes,
ClassLoader clsLdr)
Unmarshals object from byte array using given class loader.
|
<T> T |
unmarshal(InputStream in,
ClassLoader clsLdr)
Unmarshals object from the input stream using given class loader.
|
setContextpublic static boolean available()
BinaryMarshaller is able to work on the current JVM.
As long as BinaryMarshaller uses JVM-private API, which is not guaranteed
to be available on all JVM, this method should be called to ensure marshaller could work properly.
Result of this method is automatically checked in constructor.
true if BinaryMarshaller can work on the current JVM or
false if it can't.public MarshallerContext getContext()
MarshallerContext.public byte[] marshal(@Nullable
Object obj)
throws IgniteCheckedException
marshal in interface Marshallermarshal in class AbstractMarshallerobj - Object to marshal.IgniteCheckedException - If marshalling failed.public void marshal(@Nullable
Object obj,
OutputStream out)
throws IgniteCheckedException
obj - Object to marshal.out - Output stream to marshal into.IgniteCheckedException - If marshalling failed.public <T> T unmarshal(byte[] bytes,
@Nullable
ClassLoader clsLdr)
throws IgniteCheckedException
unmarshal in interface Marshallerunmarshal in class AbstractMarshallerT - Type of unmarshalled object.bytes - Byte array.clsLdr - Class loader to use.IgniteCheckedException - If unmarshalling failed.public <T> T unmarshal(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException
T - Type of unmarshalled object.in - Input stream.clsLdr - Class loader to use.IgniteCheckedException - If unmarshalling failed.public void onUndeploy(ClassLoader ldr)
onUndeploy in class AbstractMarshallerldr - Class loader being undeployed.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.7.0 Release Date : August 1 2016