Class RBMBackedTimestampSetSerialiser
- java.lang.Object
-
- uk.gov.gchq.gaffer.time.serialisation.RBMBackedTimestampSetSerialiser
-
- All Implemented Interfaces:
Serializable
,Serialiser<RBMBackedTimestampSet,byte[]>
,ToBytesSerialiser<RBMBackedTimestampSet>
public class RBMBackedTimestampSetSerialiser extends Object implements ToBytesSerialiser<RBMBackedTimestampSet>
ARBMBackedTimestampSetSerialiser
serialises aRBMBackedTimestampSet
to an array of bytes.The following figures illustrate the serialised size of some
RBMBackedTimestampSet
s with different numbers of timestamps added and different time buckets:- When the time bucket is a minute and 100 random minutes from a single day are added then the serialised size is approximately 210 bytes.
- When the time bucket is a minute and every minute in a single year is added then the serialised size is approximately 73000 bytes.
- When the time bucket is a second and every second in a single year is added then the serialised size is approximately 4,000,000 bytes.
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface uk.gov.gchq.gaffer.serialisation.ToBytesSerialiser
EMPTY_BYTES
-
-
Constructor Summary
Constructors Constructor Description RBMBackedTimestampSetSerialiser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canHandle(Class clazz)
Check whether the serialiser can serialise a particular class.RBMBackedTimestampSet
deserialise(byte[] bytes)
Deserialise an array of bytes into the original object.RBMBackedTimestampSet
deserialise(byte[] allBytes, int offset, int length)
RBMBackedTimestampSet
deserialiseEmpty()
Handle an empty byte array and reconstruct an appropriate representation in T form.boolean
equals(Object obj)
int
hashCode()
boolean
isConsistent()
Indicates whether the serialisation process produces a predictable, consistent OUTPUT, from a given INPUT, ie the same object should always serialise in the same way for this to be true.boolean
preservesObjectOrdering()
Indicates whether the serialisation process preserves the ordering of the T, i.e.byte[]
serialise(RBMBackedTimestampSet rbmBackedTimestampSet)
Serialise some object and returns the raw bytes of the serialised form.-
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface uk.gov.gchq.gaffer.serialisation.ToBytesSerialiser
serialiseNull
-
-
-
-
Method Detail
-
canHandle
public boolean canHandle(Class clazz)
Description copied from interface:Serialiser
Check whether the serialiser can serialise a particular class.//Warning: Due to erasure you may get false positives. e.g.
Set<Foo> set = Sets.newHashSet(); boolean b = new Serialiser<Set<Bar>, byte[]>().canHandle(set.getClass()); b will incorrectly be true because of type erasure between Set<Foo> Set<Bar>
- Specified by:
canHandle
in interfaceSerialiser<RBMBackedTimestampSet,byte[]>
- Parameters:
clazz
- the object class to serialise- Returns:
- boolean true if it can be handled
-
serialise
public byte[] serialise(RBMBackedTimestampSet rbmBackedTimestampSet) throws SerialisationException
Description copied from interface:ToBytesSerialiser
Serialise some object and returns the raw bytes of the serialised form.- Specified by:
serialise
in interfaceSerialiser<RBMBackedTimestampSet,byte[]>
- Specified by:
serialise
in interfaceToBytesSerialiser<RBMBackedTimestampSet>
- Parameters:
rbmBackedTimestampSet
- the object to be serialised- Returns:
- byte[] the serialised bytes
- Throws:
SerialisationException
- if the object fails to serialise
-
deserialise
public RBMBackedTimestampSet deserialise(byte[] allBytes, int offset, int length) throws SerialisationException
- Specified by:
deserialise
in interfaceToBytesSerialiser<RBMBackedTimestampSet>
- 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
-
deserialise
public RBMBackedTimestampSet deserialise(byte[] bytes) throws SerialisationException
Description copied from interface:ToBytesSerialiser
Deserialise an array of bytes into the original object.- Specified by:
deserialise
in interfaceSerialiser<RBMBackedTimestampSet,byte[]>
- Specified by:
deserialise
in interfaceToBytesSerialiser<RBMBackedTimestampSet>
- 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:
ToBytesSerialiser.deserialise(byte[], int, int)
-
deserialiseEmpty
public RBMBackedTimestampSet deserialiseEmpty() throws SerialisationException
Description copied from interface:ToBytesSerialiser
Handle an empty byte array and reconstruct an appropriate representation in T form.- Specified by:
deserialiseEmpty
in interfaceSerialiser<RBMBackedTimestampSet,byte[]>
- Specified by:
deserialiseEmpty
in interfaceToBytesSerialiser<RBMBackedTimestampSet>
- Returns:
- T the deserialised object
- Throws:
SerialisationException
- if the object fails to deserialise
-
preservesObjectOrdering
public boolean preservesObjectOrdering()
Description copied from interface:ToBytesSerialiser
Indicates whether the serialisation process preserves the ordering of the T, i.e. if x and y are objects of class T, and x is less than y, then this method should return true if the serialised form of x is guaranteed to be less than the serialised form of y (using the standard ordering of byte arrays). If T is not Comparable then this test makes no sense and false should be returned.- Specified by:
preservesObjectOrdering
in interfaceSerialiser<RBMBackedTimestampSet,byte[]>
- Specified by:
preservesObjectOrdering
in interfaceToBytesSerialiser<RBMBackedTimestampSet>
- Returns:
- true if the serialisation will preserve the order of the T, otherwise false.
-
isConsistent
public boolean isConsistent()
Description copied from interface:Serialiser
Indicates whether the serialisation process produces a predictable, consistent OUTPUT, from a given INPUT, ie the same object should always serialise in the same way for this to be true.- Specified by:
isConsistent
in interfaceSerialiser<RBMBackedTimestampSet,byte[]>
- Returns:
- true if serialisation is consistent for a given object, otherwise false.
-
-