public class ReservoirNumbersUnionSerialiser extends Object implements ToBytesSerialiser<com.yahoo.sketches.sampling.ReservoirItemsUnion<Number>>
ReservoirNumbersUnionSerialiser
serialises a ReservoirItemsUnion
of Number
s using its
toByteArray()
method.EMPTY_BYTES
Constructor and Description |
---|
ReservoirNumbersUnionSerialiser() |
Modifier and Type | Method and Description |
---|---|
boolean |
canHandle(Class clazz)
Check whether the serialiser can serialise a particular class.
|
com.yahoo.sketches.sampling.ReservoirItemsUnion<Number> |
deserialise(byte[] bytes)
Deserialise an array of bytes into the original object.
|
com.yahoo.sketches.sampling.ReservoirItemsUnion<Number> |
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(com.yahoo.sketches.sampling.ReservoirItemsUnion<Number> union)
Serialise some object and returns the raw bytes of the serialised form.
|
getClass, notify, notifyAll, toString, wait, wait, wait
deserialise, serialiseNull
public boolean canHandle(Class clazz)
Serialiser
//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>
canHandle
in interface Serialiser<com.yahoo.sketches.sampling.ReservoirItemsUnion<Number>,byte[]>
clazz
- the object class to serialisepublic byte[] serialise(com.yahoo.sketches.sampling.ReservoirItemsUnion<Number> union) throws SerialisationException
ToBytesSerialiser
serialise
in interface Serialiser<com.yahoo.sketches.sampling.ReservoirItemsUnion<Number>,byte[]>
serialise
in interface ToBytesSerialiser<com.yahoo.sketches.sampling.ReservoirItemsUnion<Number>>
union
- the object to be serialisedSerialisationException
- if the object fails to serialisepublic com.yahoo.sketches.sampling.ReservoirItemsUnion<Number> deserialise(byte[] bytes) throws SerialisationException
ToBytesSerialiser
deserialise
in interface Serialiser<com.yahoo.sketches.sampling.ReservoirItemsUnion<Number>,byte[]>
deserialise
in interface ToBytesSerialiser<com.yahoo.sketches.sampling.ReservoirItemsUnion<Number>>
bytes
- the bytes to deserialiseSerialisationException
- if the object fails to deserialise
Note that this implementation is less efficient than using deserialise with an offset and a length, but may still be used if necessary.
ToBytesSerialiser.deserialise(byte[], int, int)
public com.yahoo.sketches.sampling.ReservoirItemsUnion<Number> deserialiseEmpty() throws SerialisationException
ToBytesSerialiser
deserialiseEmpty
in interface Serialiser<com.yahoo.sketches.sampling.ReservoirItemsUnion<Number>,byte[]>
deserialiseEmpty
in interface ToBytesSerialiser<com.yahoo.sketches.sampling.ReservoirItemsUnion<Number>>
SerialisationException
- if the object fails to deserialisepublic boolean preservesObjectOrdering()
ToBytesSerialiser
preservesObjectOrdering
in interface Serialiser<com.yahoo.sketches.sampling.ReservoirItemsUnion<Number>,byte[]>
preservesObjectOrdering
in interface ToBytesSerialiser<com.yahoo.sketches.sampling.ReservoirItemsUnion<Number>>
public boolean isConsistent()
Serialiser
isConsistent
in interface Serialiser<com.yahoo.sketches.sampling.ReservoirItemsUnion<Number>,byte[]>
Copyright © 2022. All rights reserved.