public interface IElementSerializer
Modifier and Type | Method and Description |
---|---|
<T> T |
deSerialize(byte[] bytes,
ClassLoader loader)
Turns a byte array into an object.
|
default <T> T |
deSerializeFrom(AsynchronousByteChannel ic,
int readTimeoutMs,
ClassLoader loader)
Convenience method to read serialized object from an
asynchronous channel.
|
default <T> T |
deSerializeFrom(InputStream is,
ClassLoader loader)
Convenience method to read serialized object from a stream.
|
default <T> T |
deSerializeFrom(ReadableByteChannel ic,
ClassLoader loader)
Convenience method to read serialized object from a channel.
|
<T> byte[] |
serialize(T obj)
Turns an object into a byte array.
|
default <T> int |
serializeTo(T obj,
AsynchronousByteChannel oc,
int writeTimeoutMs)
Convenience method to write serialized object into an
asynchronous channel.
|
default <T> int |
serializeTo(T obj,
OutputStream os)
Convenience method to write serialized object into a stream.
|
default <T> int |
serializeTo(T obj,
WritableByteChannel oc)
Convenience method to write serialized object into a channel.
|
<T> byte[] serialize(T obj) throws IOException
T
- the type of the objectobj
- the object to serializeIOException
- if serialization fails<T> T deSerialize(byte[] bytes, ClassLoader loader) throws IOException, ClassNotFoundException
bytes
- data bytesloader
- class loader to useIOException
- if de-serialization failsClassNotFoundException
- thrown if we don't know the object.default <T> int serializeTo(T obj, OutputStream os) throws IOException
T
- the type of the objectobj
- the object to serializeos
- the output streamIOException
- if serialization or writing failsdefault <T> int serializeTo(T obj, WritableByteChannel oc) throws IOException
T
- the type of the objectobj
- the object to serializeoc
- the output channelIOException
- if serialization or writing failsdefault <T> int serializeTo(T obj, AsynchronousByteChannel oc, int writeTimeoutMs) throws IOException
T
- the type of the objectobj
- the object to serializeoc
- the output channelwriteTimeoutMs
- the write timeout im millisecondsIOException
- if serialization or writing failsdefault <T> T deSerializeFrom(InputStream is, ClassLoader loader) throws IOException, ClassNotFoundException
T
- the type of the objectis
- the input streamloader
- class loader to useIOException
- if serialization or reading failsClassNotFoundException
- thrown if we don't know the object.default <T> T deSerializeFrom(ReadableByteChannel ic, ClassLoader loader) throws IOException, ClassNotFoundException
T
- the type of the objectic
- the input channelloader
- class loader to useIOException
- if serialization or reading failsClassNotFoundException
- thrown if we don't know the object.default <T> T deSerializeFrom(AsynchronousByteChannel ic, int readTimeoutMs, ClassLoader loader) throws IOException, ClassNotFoundException
T
- the type of the objectic
- the input channelreadTimeoutMs
- the read timeout in millisecondsloader
- class loader to useIOException
- if serialization or reading failsClassNotFoundException
- thrown if we don't know the object.Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.