public class FastSerialize extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FastSerialize.SerialisableType |
| Modifier and Type | Method and Description |
|---|---|
static Object |
fastDeserialize(byte[] data)
Deserialise an object from a byte array using the FastSerializable approach where possible.
|
static Object |
fastDeserialize(byte[] data,
ClassLoader classLoader)
Deserialise an object from a byte array using the FastSerializable approach where possible.
|
static Object |
fastDeserialize(byte[] data,
int offset,
int length)
Deserialise an object from a byte array using the FastSerializable approach where possible.
|
static Object |
fastDeserialize(byte[] data,
int offset,
int length,
ClassLoader classLoader)
Deserialise an object from a byte array using the FastSerializable approach where possible.
|
static byte[] |
fastSerialize(Object obj)
Serialise an object to a byte array using the FastSerializable approach where possible.
|
static Object |
fromStream(DataInput in)
Deserialise an object from a stream using the FastSerializable where possible.
|
static Object |
fromStream(DataInput in,
ClassLoader classLoader)
Deserialise an object from a stream using the FastSerializable where possible.
|
static FastSerialize.SerialisableType |
getType(Class c) |
static String |
readString(DataInput inStream)
Read a string value from the specified data input stream.
|
static Object |
standardDeserialize(byte[] byteArray)
Deserialise an object from a byte array using the standard Java deserialisation approach.
|
static Object |
standardDeserialize(byte[] byteArray,
ClassLoader classLoader)
Deserialise an object from a byte array using the standard Java deserialisation approach.
|
static Object |
standardDeserialize(byte[] byteArray,
int offset,
int length)
Deserialise an object from a byte array using the standard Java serialisation approach.
|
static Object |
standardDeserialize(byte[] byteArray,
int offset,
int length,
ClassLoader classLoader)
Deserialise an object from a byte array using the standard Java serialisation approach.
|
static byte[] |
standardSerialize(Object toSerialise)
Serialise an object to a byte array using the standard Java serialisation approach.
|
static void |
toStream(Object obj,
DataOutput out)
Serialise an object to a stream using the FastSerializable approach where possible.
|
static FastSerialize.SerialisableType |
toStreamAndGetType(Object obj,
DataOutput out)
Serialise an object to a stream using the FastSerializable approach where possible.
|
static void |
writeString(String value,
DataOutput outStream)
Write a string value to the specified data output stream.
|
public static String readString(DataInput inStream) throws IOException
inStream - the input stream to read from.null if a null string value was stored in the stream.IOException - if an I/O error occurs.public static void writeString(String value, DataOutput outStream) throws IOException
value - the string value to write. May be null.outStream - the output stream to write to.IOException - if an I/O error occurs.public static byte[] standardSerialize(Object toSerialise) throws IOException
toSerialise - the object to serialise. May be null.null if the input toSerialise argument is null.IOException - if an I/O error occurs.public static Object standardDeserialize(byte[] byteArray) throws IOException
This method is equivalent to standardDeserialise(byteArray, Thread.currentThread().getContextClassLoader()).
byteArray - the serialised data to deserialise. May be null.null if the input byteArray argument is null.IOException - if an I/O error occurs.public static Object standardDeserialize(byte[] byteArray, ClassLoader classLoader) throws IOException
If the input byteArray argument is not null then this method is equivalent to
standardDeserialize(byteArray, 0, byteArray.length, classLoader).
byteArray - the serialised data to deserialise. May be null.classLoader - the class loader to be used during deserialisation.null if the input byteArray argument is null.IOException - if an I/O error occurs.public static Object standardDeserialize(byte[] byteArray, int offset, int length) throws IOException
This method is equivalent to standardDeserialize(byteArray, offset, length, Thread.currentThread().getContextClassLoader()).
byteArray - the serialised data to deserialise. May be null.offset - the offset within byteArray of the data to start deserialisation from.length - the length of data within byteArray to be read.null if the input byteArray argument is null.IOException - if an I/O error occurs.public static Object standardDeserialize(byte[] byteArray, int offset, int length, ClassLoader classLoader) throws IOException
byteArray - the serialised data to deserialise. May be null.offset - the offset within byteArray of the data to start deserialisation from.length - the length of data within byteArray to be read.classLoader - the class loader to be used during deserialisation.null if the input byteArray argument is null.IOException - if an I/O error occurs.public static byte[] fastSerialize(Object obj) throws IOException
fastDeserialize(byte[]).
This method uses toStream(Object, DataOutput) to do the actual serialisation.
obj - the object to serialise. May be null.IOException - if an I/O error occurs.public static Object fastDeserialize(byte[] data) throws IOException
This method is equivalent to fastDeserialize(data, 0, data.length, Thread.currentThread().getContextClassLoader()).
data - the serialised data (from fastSerialize(Object)) to deserialise.null if a null value was stored.IOException - if an I/O error occurs.public static Object fastDeserialize(byte[] data, int offset, int length) throws IOException
This method is equivalent to fastDeserialize(data, offset, length, Thread.currentThread().getContextClassLoader()).
data - the serialised data (from fastSerialize(Object)) to deserialise.offset - the offset within byteArray of the data to start deserialisation from.length - the length of data within byteArray to be read.null if a null value was stored.IOException - if an I/O error occurs.public static Object fastDeserialize(byte[] data, ClassLoader classLoader) throws IOException
This method is equivalent to fastDeserialize(data, 0, data.length, classLoader).
data - the serialised data (from fastSerialize(Object)) to deserialise.classLoader - the class loader to be used during deserialisation.null if a null value was stored.IOException - if an I/O error occurs.public static Object fastDeserialize(byte[] data, int offset, int length, ClassLoader classLoader) throws IOException
This method uses fromStream(DataInput, ClassLoader) to do the actual deserialisation.
data - the serialised data (from fastSerialize(Object)) to deserialise.offset - the offset within byteArray of the data to start deserialisation from.length - the length of data within byteArray to be read.classLoader - the class loader to be used during deserialisation.null if a null value was stored.IOException - if an I/O error occurs.public static FastSerialize.SerialisableType toStreamAndGetType(Object obj, DataOutput out) throws IOException
The resulting stream may be deserialised using fromStream(DataInput, ClassLoader).
obj - the object to serialise. May be null.out - the stream to serialise toIOException - if an I/O error occurs.public static void toStream(Object obj, DataOutput out) throws IOException
The resulting stream may be deserialised using fromStream(DataInput, ClassLoader).
obj - the object to serialise. May be null.out - the stream to serialise toIOException - if an I/O error occurs.public static Object fromStream(DataInput in) throws IOException
toStream(Object, DataOutput).
This method is equivalent to fromStream(in, Thread.currentThread().getContextClassLoader()).
in - the stream to deserialise.null if a null value was stored.IOException - if an I/O error occurs.public static Object fromStream(DataInput in, ClassLoader classLoader) throws IOException
toStream(Object, DataOutput).in - the stream to deserialise.classLoader - the class loader to be used during deserialisation.null if a null value was stored.IOException - if an I/O error occurs.public static FastSerialize.SerialisableType getType(Class c)