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 Tdeserialise(byte[] bytes)Deprecated.Tdeserialise(byte[] allBytes, int offset, int length)StringgetCharset()byte[]serialise(T object)Serialise some object and returns the raw bytes of the serialised form.voidsetCharset(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:
deserialisein interfaceSerialiser<T,byte[]>- Specified by:
deserialisein 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:
deserialisein 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:ToBytesSerialiserSerialise some object and returns the raw bytes of the serialised form.- Specified by:
serialisein interfaceSerialiser<T,byte[]>- Specified by:
serialisein interfaceToBytesSerialiser<T>- Parameters:
object- the object to be serialised- Returns:
- byte[] the serialised bytes
- Throws:
SerialisationException- if the object fails to serialise
-
-