public class ArrayOfStringsSerDe extends ArrayOfItemsSerDe<String>
ArrayOfUtf16StringsSerDe
. In an extreme case when all strings are in ASCII,
this method is 2 times more compact, but it takes more time to encode and decode
by a factor of 1.5 to 2.
The serialization
Constructor and Description |
---|
ArrayOfStringsSerDe() |
Modifier and Type | Method and Description |
---|---|
String[] |
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.
|
String[] |
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<String> |
getClassOfT()
Returns the concrete class of type T
|
byte[] |
serializeToByteArray(String item)
Serialize a single unserialized item to a byte array.
|
byte[] |
serializeToByteArray(String[] items)
Serialize an array of unserialized items to a byte array of contiguous serialized items.
|
int |
sizeOf(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.
|
int |
sizeOf(String item)
Returns the serialized size in bytes of a single unserialized item.
|
String |
toString(String item)
Returns a human readable string of an item.
|
sizeOf
public byte[] serializeToByteArray(String item)
ArrayOfItemsSerDe
serializeToByteArray
in class ArrayOfItemsSerDe<String>
item
- the item to be serializedpublic byte[] serializeToByteArray(String[] items)
ArrayOfItemsSerDe
serializeToByteArray
in class ArrayOfItemsSerDe<String>
items
- array of items to be serializedpublic String[] deserializeFromMemory(org.apache.datasketches.memory.Memory mem, int numItems)
ArrayOfItemsSerDe
deserializeFromMemory
in class ArrayOfItemsSerDe<String>
mem
- Memory containing a contiguous sequence of serialized itemsnumItems
- number of items in the contiguous serialized sequence.ArrayOfItemsSerDe.deserializeFromMemory(Memory, long, int)
public String[] deserializeFromMemory(org.apache.datasketches.memory.Memory mem, long offsetBytes, int numItems)
ArrayOfItemsSerDe
deserializeFromMemory
in class ArrayOfItemsSerDe<String>
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.public int sizeOf(String item)
ArrayOfItemsSerDe
sizeOf
in class ArrayOfItemsSerDe<String>
item
- a specific itempublic int sizeOf(org.apache.datasketches.memory.Memory mem, long offsetBytes, int numItems)
ArrayOfItemsSerDe
sizeOf
in class ArrayOfItemsSerDe<String>
mem
- the given Memory.offsetBytes
- the starting offset in the given Memory.numItems
- the number of serialized items contained in the Memorypublic String toString(String item)
ArrayOfItemsSerDe
toString
in class ArrayOfItemsSerDe<String>
item
- a specific itempublic Class<String> getClassOfT()
ArrayOfItemsSerDe
getClassOfT
in class ArrayOfItemsSerDe<String>
Copyright © 2015–2024 The Apache Software Foundation. All rights reserved.