Class ArrayOfUtf16StringsSerDe


  • public class ArrayOfUtf16StringsSerDe
    extends ArrayOfItemsSerDe<String>
    Methods of serializing and deserializing arrays of String. This class serializes strings using internal Java representation as char[], where each char is a 16-bit code. The result is larger than one from ArrayOfStringsSerDe. In an extreme case when all strings are in ASCII, the size is doubled. However it takes less time to serialize and deserialize by a factor of 1.5 to 2.
    Author:
    Alexander Saydakov
    • Constructor Detail

      • ArrayOfUtf16StringsSerDe

        public ArrayOfUtf16StringsSerDe()
    • Method Detail

      • serializeToByteArray

        public byte[] serializeToByteArray​(String[] items)
        Description copied from class: ArrayOfItemsSerDe
        Serialize 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:
        serializeToByteArray in class ArrayOfItemsSerDe<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: ArrayOfItemsSerDe
        Deserialize an array of items from a given Memory object. This method is called by the sketch deserialization process.
        Specified by:
        deserializeFromMemory in class ArrayOfItemsSerDe<String>
        Parameters:
        mem - Memory containing a serialized array of items
        numItems - number of items in the serialized array
        Returns:
        deserialized array of items