Package org.apache.datasketches.common
Class ArrayOfNumbersSerDe
- java.lang.Object
-
- org.apache.datasketches.common.ArrayOfItemsSerDe<Number>
-
- org.apache.datasketches.common.ArrayOfNumbersSerDe
-
public class ArrayOfNumbersSerDe extends ArrayOfItemsSerDe<Number>
Methods of serializing and deserializing arrays of the object version of primitive types of Number. The array can be a mix of primitive object types.This class serializes numbers with a leading byte (ASCII character) indicating the type. The class keeps the values byte aligned, even though only 3 bits are strictly necessary to encode one of the 6 different primitives with object types that extend Number.
Classes handled are:
Long,Integer,Short,Byte,Double, andFloat.- Author:
- Jon Malkin
-
-
Constructor Summary
Constructors Constructor Description ArrayOfNumbersSerDe()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Number[]deserializeFromMemory(org.apache.datasketches.memory.Memory mem, int length)Deserialize an array of items from a given Memory object.byte[]serializeToByteArray(Number[] items)Serialize an array of items to byte array.
-
-
-
Method Detail
-
serializeToByteArray
public byte[] serializeToByteArray(Number[] items)
Description copied from class:ArrayOfItemsSerDeSerialize an array of items to byte array. The size of the array doesn't need to be serialized. This method is called by the sketch serialization process.- Specified by:
serializeToByteArrayin classArrayOfItemsSerDe<Number>- Parameters:
items- array of items to be serialized- Returns:
- serialized representation of the given array of items
-
deserializeFromMemory
public Number[] deserializeFromMemory(org.apache.datasketches.memory.Memory mem, int length)
Description copied from class:ArrayOfItemsSerDeDeserialize an array of items from a given Memory object. This method is called by the sketch deserialization process.- Specified by:
deserializeFromMemoryin classArrayOfItemsSerDe<Number>- Parameters:
mem- Memory containing a serialized array of itemslength- number of items in the serialized array- Returns:
- deserialized array of items
-
-