Package org.apache.datasketches.common
Class ArrayOfStringsSerDe
- java.lang.Object
-
- org.apache.datasketches.common.ArrayOfItemsSerDe<String>
-
- org.apache.datasketches.common.ArrayOfStringsSerDe
-
public class ArrayOfStringsSerDe extends ArrayOfItemsSerDe<String>
Methods of serializing and deserializing arrays of String. This class serializes strings in UTF-8 format, which is more compact compared toArrayOfUtf16StringsSerDe. 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.- Author:
- Alexander Saydakov
-
-
Constructor Summary
Constructors Constructor Description ArrayOfStringsSerDe()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]deserializeFromMemory(org.apache.datasketches.memory.Memory mem, int numItems)Deserialize an array of items from a given Memory object.byte[]serializeToByteArray(String[] items)Serialize an array of items to byte array.
-
-
-
Method Detail
-
serializeToByteArray
public byte[] serializeToByteArray(String[] 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<String>- Parameters:
items- array of items to be serialized- Returns:
- serialized representation of the given array of items
-
deserializeFromMemory
public String[] deserializeFromMemory(org.apache.datasketches.memory.Memory mem, int numItems)
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<String>- Parameters:
mem- Memory containing a serialized array of itemsnumItems- number of items in the serialized array- Returns:
- deserialized array of items
-
-