Package org.apache.datasketches.common
Class ArrayOfDoublesSerDe
- java.lang.Object
-
- org.apache.datasketches.common.ArrayOfItemsSerDe<Double>
-
- org.apache.datasketches.common.ArrayOfDoublesSerDe
-
public class ArrayOfDoublesSerDe extends ArrayOfItemsSerDe<Double>
Methods of serializing and deserializing arrays of Double.- Author:
- Alexander Saydakov
-
-
Constructor Summary
Constructors Constructor Description ArrayOfDoublesSerDe()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Double[]deserializeFromMemory(org.apache.datasketches.memory.Memory mem, int numItems)Deserialize a contiguous sequence of serialized items from the given Memory starting at a Memory offset of zero and extending numItems.Double[]deserializeFromMemory(org.apache.datasketches.memory.Memory mem, long offsetBytes, int numItems)Deserialize a contiguous sequence of serialized items from the given Memory starting at the given Memory offsetBytes and extending numItems.Class<Double>getClassOfT()Returns the concrete class of type Tbyte[]serializeToByteArray(Double item)Serialize a single unserialized item to a byte array.byte[]serializeToByteArray(Double[] items)Serialize an array of unserialized items to a byte array of contiguous serialized items.intsizeOf(Double item)Returns the serialized size in bytes of a single unserialized item.intsizeOf(Double[] items)Returns the serialized size in bytes of the array of items.intsizeOf(org.apache.datasketches.memory.Memory mem, long offsetBytes, int numItems)Returns the serialized size in bytes of the number of contiguous serialized items in Memory.StringtoString(Double item)Returns a human readable string of an item.
-
-
-
Method Detail
-
serializeToByteArray
public byte[] serializeToByteArray(Double item)
Description copied from class:ArrayOfItemsSerDeSerialize a single unserialized item to a byte array.- Specified by:
serializeToByteArrayin classArrayOfItemsSerDe<Double>- Parameters:
item- the item to be serialized- Returns:
- serialized representation of the given item
-
serializeToByteArray
public byte[] serializeToByteArray(Double[] items)
Description copied from class:ArrayOfItemsSerDeSerialize an array of unserialized items to a byte array of contiguous serialized items.- Specified by:
serializeToByteArrayin classArrayOfItemsSerDe<Double>- Parameters:
items- array of items to be serialized- Returns:
- contiguous, serialized representation of the given array of unserialized items
-
deserializeFromMemory
public Double[] deserializeFromMemory(org.apache.datasketches.memory.Memory mem, int numItems)
Description copied from class:ArrayOfItemsSerDeDeserialize a contiguous sequence of serialized items from the given Memory starting at a Memory offset of zero and extending numItems.- Overrides:
deserializeFromMemoryin classArrayOfItemsSerDe<Double>- Parameters:
mem- Memory containing a contiguous sequence of serialized itemsnumItems- number of items in the contiguous serialized sequence.- Returns:
- array of deserialized items
- See Also:
ArrayOfItemsSerDe.deserializeFromMemory(Memory, long, int)
-
deserializeFromMemory
public Double[] deserializeFromMemory(org.apache.datasketches.memory.Memory mem, long offsetBytes, int numItems)
Description copied from class:ArrayOfItemsSerDeDeserialize a contiguous sequence of serialized items from the given Memory starting at the given Memory offsetBytes and extending numItems.- Specified by:
deserializeFromMemoryin classArrayOfItemsSerDe<Double>- Parameters:
mem- Memory containing a contiguous sequence of serialized itemsoffsetBytes- the starting offset in the given Memory.numItems- number of items in the contiguous serialized sequence.- Returns:
- array of deserialized items
-
sizeOf
public int sizeOf(Double item)
Description copied from class:ArrayOfItemsSerDeReturns the serialized size in bytes of a single unserialized item.- Specified by:
sizeOfin classArrayOfItemsSerDe<Double>- Parameters:
item- a specific item- Returns:
- the serialized size in bytes of a single unserialized item.
-
sizeOf
public int sizeOf(Double[] items)
Description copied from class:ArrayOfItemsSerDeReturns the serialized size in bytes of the array of items.- Overrides:
sizeOfin classArrayOfItemsSerDe<Double>- Parameters:
items- an array of items.- Returns:
- the serialized size in bytes of the array of items.
-
sizeOf
public int sizeOf(org.apache.datasketches.memory.Memory mem, long offsetBytes, int numItems)Description copied from class:ArrayOfItemsSerDeReturns the serialized size in bytes of the number of contiguous serialized items in Memory. The capacity of the given Memory can be much larger that the required size of the items.- Specified by:
sizeOfin classArrayOfItemsSerDe<Double>- Parameters:
mem- the given Memory.offsetBytes- the starting offset in the given Memory.numItems- the number of serialized items contained in the Memory- Returns:
- the serialized size in bytes of the given number of items.
-
toString
public String toString(Double item)
Description copied from class:ArrayOfItemsSerDeReturns a human readable string of an item.- Specified by:
toStringin classArrayOfItemsSerDe<Double>- Parameters:
item- a specific item- Returns:
- a human readable string of an item.
-
getClassOfT
public Class<Double> getClassOfT()
Description copied from class:ArrayOfItemsSerDeReturns the concrete class of type T- Specified by:
getClassOfTin classArrayOfItemsSerDe<Double>- Returns:
- the concrete class of type T
-
-