Package uk.gov.gchq.gaffer.serialisation
Class ToBytesViaStringDeserialiser<T>
- java.lang.Object
-
- uk.gov.gchq.gaffer.serialisation.ToBytesViaStringDeserialiser<T>
-
- All Implemented Interfaces:
Serializable
,Serialiser<T,byte[]>
,ToBytesSerialiser<T>
- Direct Known Subclasses:
StringSerialiser
,TreeSetStringSerialiser
public abstract class ToBytesViaStringDeserialiser<T> extends Object implements ToBytesSerialiser<T>
Abstract serialiser that deserialises the given byte[] via an interim String object. The concrete implementation of this class may use the string in the constructor of the final return type.
example :@Override public Date deserialiseString(final String value) { return new Date(Long.parseLong(value)); }
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface uk.gov.gchq.gaffer.serialisation.ToBytesSerialiser
EMPTY_BYTES
-
-
Constructor Summary
Constructors Constructor Description ToBytesViaStringDeserialiser(String charsetName)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description T
deserialise(byte[] bytes)
Deprecated.T
deserialise(byte[] allBytes, int offset, int length)
String
getCharset()
byte[]
serialise(T object)
Serialise some object and returns the raw bytes of the serialised form.void
setCharset(String charset)
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface uk.gov.gchq.gaffer.serialisation.Serialiser
canHandle, isConsistent
-
Methods inherited from interface uk.gov.gchq.gaffer.serialisation.ToBytesSerialiser
deserialiseEmpty, preservesObjectOrdering, serialiseNull
-
-
-
-
Constructor Detail
-
ToBytesViaStringDeserialiser
public ToBytesViaStringDeserialiser(String charsetName)
-
-
Method Detail
-
getCharset
public String getCharset()
-
setCharset
public void setCharset(String charset)
-
deserialise
@Deprecated public final T deserialise(byte[] bytes) throws SerialisationException
Deprecated.Deserialise an array of bytes into the original object.- Specified by:
deserialise
in interfaceSerialiser<T,byte[]>
- Specified by:
deserialise
in interfaceToBytesSerialiser<T>
- Parameters:
bytes
- the bytes to deserialise- Returns:
- T the deserialised object
- Throws:
SerialisationException
- if the object fails to deserialiseNote that this implementation is less efficient than using deserialise with an offset and a length, but may still be used if necessary. It has been marked deprecated but will not be removed as it is needed in the Serialiser interface.
- See Also:
deserialise(byte[], int, int)
-
deserialise
public final T deserialise(byte[] allBytes, int offset, int length) throws SerialisationException
- Specified by:
deserialise
in interfaceToBytesSerialiser<T>
- Parameters:
allBytes
- The bytes to be decoded into charactersoffset
- The index of the first byte to decodelength
- The number of bytes to decode- Returns:
- T the deserialised object
- Throws:
SerialisationException
- issues during deserialisation
-
serialise
public byte[] serialise(T object) throws SerialisationException
Description copied from interface:ToBytesSerialiser
Serialise some object and returns the raw bytes of the serialised form.- Specified by:
serialise
in interfaceSerialiser<T,byte[]>
- Specified by:
serialise
in interfaceToBytesSerialiser<T>
- Parameters:
object
- the object to be serialised- Returns:
- byte[] the serialised bytes
- Throws:
SerialisationException
- if the object fails to serialise
-
-