Class BmStringSerializer


  • public final class BmStringSerializer
    extends Object
    String serialization utilities.
    • Constructor Detail

      • BmStringSerializer

        public BmStringSerializer()
    • Method Detail

      • serialize

        public static void serialize​(DataOutput out,
                                     String value)
                              throws IOException
        Serializes the specified string value. Compresses strings longer than 32768 characters.
        Parameters:
        out - The data output to write the serialized representation to. May not be null.
        value - the string value to serialize. May be null.
        Throws:
        IOException
      • deserialize

        public static String deserialize​(DataInput in)
                                  throws IOException
        Deserializes a string value from a serialized representation created with serialize(DataOutput, String) method.
        Parameters:
        in - The data input to read the serialized representation from. May not be null.
        Returns:
        the deserialized value. May be null.
        Throws:
        IOException
      • serialize

        public static byte[] serialize​(String value)
                                throws IOException
        Serializes the specified string value. Compresses strings longer than 32768 characters.
        Parameters:
        value - the string value to serialize. May be null.
        Returns:
        a byte array containing the serialized representation. May not be null.
        Throws:
        IOException
      • deserialize

        public static String deserialize​(byte[] data)
                                  throws IOException
        Deserializes a string value from a serialized representation created with serialize(String).
        Parameters:
        data - A byte array containing the serialized data. May not be null.
        Returns:
        the deserialized value. May be null.
        Throws:
        IOException
      • deserialize

        public static String deserialize​(byte[] data,
                                         int offset,
                                         int length)
                                  throws IOException
        Deserializes a string value from a serialized representation created with serialize(String).
        Parameters:
        data - A byte array containing the serialized data. May not be null.
        offset - The offset of the serialized data within the array.
        length - The length of the serialied data.
        Returns:
        the deserialized value. May be null.
        Throws:
        IOException
      • serialize2

        public static byte[] serialize2​(String value)
        Serializes the specified string value.
        Parameters:
        value - the string value to serialize. May be null.
        Returns:
        a byte array containing the serialized representation. Never null.
      • deserialize2

        public static String deserialize2​(ByteBuffer data)
        Deserializes a string value from a serialized representation created with serialize2(String).
        Parameters:
        data - The byte buffer containing serialized data. May not be null.
        Returns:
        the deserialized value. May be null.
      • serialize2

        public static void serialize2​(String value,
                                      DataOutput out)
                               throws IOException
        Serializes the specified string value.
        Parameters:
        value - the string value to serialize. May be null.
        out - The data output to write the serialized representation to. May not be null.
        Throws:
        IOException
      • deserialize2

        public static String deserialize2​(DataInput in)
                                   throws IOException
        Deserializes a string value from a serialized representation created with serialize2(String, DataOutput) method.
        Parameters:
        in - The data input to read the serialized representation from. May not be null.
        Returns:
        the deserialized value. May be null.
        Throws:
        IOException
      • serialize3

        public static void serialize3​(String value,
                                      DataOutput out)
                               throws IOException
        Serializes the specified string value.
        Parameters:
        value - the string value to serialize. May not be null.
        out - The data output to write the serialized representation to. May not be null.
        Throws:
        IOException
      • deserialize3

        public static String deserialize3​(DataInput in)
                                   throws IOException
        Deserializes a string value from a serialized representation created with serialize3(String, DataOutput) method.
        Parameters:
        in - The data input to read the serialized representation from. May not be null.
        Returns:
        the deserialized value. May not be null.
        Throws:
        IOException