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 class
LengthValueBytesSerialiserUtil.LengthValueBuilder
static class
LengthValueBytesSerialiserUtil.ObjectCarriage<T>
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ByteArrayOutputStream
appendLengthValueFromBytesToByteStream(ByteArrayOutputStream byteOut, byte[] serialisedObject)
static ByteArrayOutputStream
appendLengthValueFromObjectToByteStream(ByteArrayOutputStream byteOut, ToBytesSerialiser serialiser, Object object)
static ByteArrayOutputStream
createByteArray()
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> T
deserialise(ToBytesSerialiser<T> serialiser, byte[] allBytes)
static <T> T
deserialise(ToBytesSerialiser<T> serialiser, byte[] allBytes, int delimiter)
static <T> T
deserialise(ToBytesSerialiser<T> serialiser, byte[] allBytes, int[] delimiterWrapper)
static <T> LengthValueBytesSerialiserUtil.ObjectCarriage<T>
deserialiseNextObject(ToBytesSerialiser<T> serialiser, int currentCarriage, byte[] bytes)
static int
getLengthSize(byte[] allBytes, int delimiter)
static int
getNextDelimiter(byte[] allBytes, byte[] valueBytes, int lastDelimiter)
static int
getNextDelimiter(byte[] allBytes, int delimiter)
static int
getNextDelimiter(byte[] allBytes, int valueSize, int lastDelimiter)
static int
getNextDelimiter(int lengthSize, int valueSize, int lastDelimiter)
static <T> byte[]
getValueBytes(ToBytesSerialiser<T> serialiser, T value)
static int
getValueSize(byte[] allBytes, int delimiter)
static int
getValueSize(byte[] allBytes, int lengthSize, int delimiter)
static byte[]
serialise(byte[] valueBytes)
static void
serialise(byte[] valueBytes, ByteArrayOutputStream out)
static <T> byte[]
serialise(ToBytesSerialiser<T> serialiser, T value)
static <T> void
serialise(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
-
-