Class LengthValueBytesSerialiserUtil
- java.lang.Object
-
- uk.gov.gchq.gaffer.serialisation.util.LengthValueBytesSerialiserUtil
-
public final class LengthValueBytesSerialiserUtil extends Object
Utility methods for serialising objects to length-value byte arrays.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLengthValueBytesSerialiserUtil.LengthValueBuilderstatic classLengthValueBytesSerialiserUtil.ObjectCarriage<T>
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ByteArrayOutputStreamappendLengthValueFromBytesToByteStream(ByteArrayOutputStream byteOut, byte[] serialisedObject)static ByteArrayOutputStreamappendLengthValueFromObjectToByteStream(ByteArrayOutputStream byteOut, ToBytesSerialiser serialiser, Object object)static ByteArrayOutputStreamcreateByteArray()static byte[]deserialise(byte[] allBytes)static byte[]deserialise(byte[] allBytes, int delimiter)static byte[]deserialise(byte[] allBytes, int[] delimiterWrapper)static byte[]deserialise(byte[] allBytes, int lengthSize, int valueSize, int delimiter)static <T> Tdeserialise(ToBytesSerialiser<T> serialiser, byte[] allBytes)static <T> Tdeserialise(ToBytesSerialiser<T> serialiser, byte[] allBytes, int delimiter)static <T> Tdeserialise(ToBytesSerialiser<T> serialiser, byte[] allBytes, int[] delimiterWrapper)static <T> LengthValueBytesSerialiserUtil.ObjectCarriage<T>deserialiseNextObject(ToBytesSerialiser<T> serialiser, int currentCarriage, byte[] bytes)static intgetLengthSize(byte[] allBytes, int delimiter)static intgetNextDelimiter(byte[] allBytes, byte[] valueBytes, int lastDelimiter)static intgetNextDelimiter(byte[] allBytes, int delimiter)static intgetNextDelimiter(byte[] allBytes, int valueSize, int lastDelimiter)static intgetNextDelimiter(int lengthSize, int valueSize, int lastDelimiter)static <T> byte[]getValueBytes(ToBytesSerialiser<T> serialiser, T value)static intgetValueSize(byte[] allBytes, int delimiter)static intgetValueSize(byte[] allBytes, int lengthSize, int delimiter)static byte[]serialise(byte[] valueBytes)static voidserialise(byte[] valueBytes, ByteArrayOutputStream out)static <T> byte[]serialise(ToBytesSerialiser<T> serialiser, T value)static <T> voidserialise(ToBytesSerialiser<T> serialiser, T value, ByteArrayOutputStream out)
-
-
-
Method Detail
-
createByteArray
public static ByteArrayOutputStream createByteArray()
-
appendLengthValueFromObjectToByteStream
public static ByteArrayOutputStream appendLengthValueFromObjectToByteStream(ByteArrayOutputStream byteOut, ToBytesSerialiser serialiser, Object object) throws SerialisationException
- Throws:
SerialisationException
-
appendLengthValueFromBytesToByteStream
public static ByteArrayOutputStream appendLengthValueFromBytesToByteStream(ByteArrayOutputStream byteOut, byte[] serialisedObject) throws SerialisationException
- Throws:
SerialisationException
-
serialise
public static <T> byte[] serialise(ToBytesSerialiser<T> serialiser, T value) throws SerialisationException
- Throws:
SerialisationException
-
serialise
public static <T> void serialise(ToBytesSerialiser<T> serialiser, T value, ByteArrayOutputStream out) throws SerialisationException
- Throws:
SerialisationException
-
serialise
public static byte[] serialise(byte[] valueBytes) throws SerialisationException- Throws:
SerialisationException
-
serialise
public static void serialise(byte[] valueBytes, ByteArrayOutputStream out) throws SerialisationException- Throws:
SerialisationException
-
deserialise
public static <T> T deserialise(ToBytesSerialiser<T> serialiser, byte[] allBytes) throws SerialisationException
- Throws:
SerialisationException
-
deserialise
public static <T> T deserialise(ToBytesSerialiser<T> serialiser, byte[] allBytes, int delimiter) throws SerialisationException
- Throws:
SerialisationException
-
deserialise
public static <T> T deserialise(ToBytesSerialiser<T> serialiser, byte[] allBytes, int[] delimiterWrapper) throws SerialisationException
- Throws:
SerialisationException
-
deserialise
public static byte[] deserialise(byte[] allBytes, int[] delimiterWrapper) throws SerialisationException- Throws:
SerialisationException
-
deserialise
public static byte[] deserialise(byte[] allBytes) throws SerialisationException- Throws:
SerialisationException
-
deserialise
public static byte[] deserialise(byte[] allBytes, int delimiter) throws SerialisationException- Throws:
SerialisationException
-
deserialise
public static byte[] deserialise(byte[] allBytes, int lengthSize, int valueSize, int delimiter) throws SerialisationException- Throws:
SerialisationException
-
getLengthSize
public static int getLengthSize(byte[] allBytes, int delimiter) throws SerialisationException- Throws:
SerialisationException
-
getValueSize
public static int getValueSize(byte[] allBytes, int delimiter) throws SerialisationException- Throws:
SerialisationException
-
getValueSize
public static int getValueSize(byte[] allBytes, int lengthSize, int delimiter) throws SerialisationException- Throws:
SerialisationException
-
getNextDelimiter
public static int getNextDelimiter(byte[] allBytes, int delimiter) throws SerialisationException- Throws:
SerialisationException
-
getNextDelimiter
public static int getNextDelimiter(byte[] allBytes, byte[] valueBytes, int lastDelimiter)
-
getNextDelimiter
public static int getNextDelimiter(byte[] allBytes, int valueSize, int lastDelimiter)
-
getNextDelimiter
public static int getNextDelimiter(int lengthSize, int valueSize, int lastDelimiter)
-
getValueBytes
public static <T> byte[] getValueBytes(ToBytesSerialiser<T> serialiser, T value) throws SerialisationException
- Throws:
SerialisationException
-
deserialiseNextObject
public static <T> LengthValueBytesSerialiserUtil.ObjectCarriage<T> deserialiseNextObject(ToBytesSerialiser<T> serialiser, int currentCarriage, byte[] bytes) throws SerialisationException
- Throws:
SerialisationException
-
-