Class SerializeHelper


  • public final class SerializeHelper
    extends Object
    Serialization helper.
    • Constructor Detail

      • SerializeHelper

        public SerializeHelper()
    • Method Detail

      • writeSize

        public static final void writeSize​(int s,
                                           ByteBuffer buffer,
                                           SerializableControl flusher)
        Serialize the specified array size into the specified buffer, flushing when necessary. The specified SerializableControl manages any flushing required.
        Parameters:
        s - size to encode
        buffer - the buffer to be serialized into
        flusher - the SerializableControl to manage the flushing
      • readSize

        public static final int readSize​(ByteBuffer buffer,
                                         DeserializableControl control)
        Deserialize the array size from the specified buffer. The specified DeserializableControl ensures sufficient bytes are available.
        Parameters:
        buffer - the buffer to serialize from
        control - the DeserializableControl
        Returns:
        the deserialized array size
      • readSize

        public static final int readSize​(ByteBuffer buffer)
        Deserialize the array size from the specified buffer.
        Parameters:
        buffer - the buffer to serialize from
        Returns:
        the deserialized array size
      • serializeString

        public static final void serializeString​(String value,
                                                 ByteBuffer buffer,
                                                 SerializableControl flusher)
        Serialize the specified string into the specified buffer, flushing when necessary. The specified SerializableControl manages any flushing required.
        Parameters:
        value - the string to be serialized
        buffer - the buffer to be serialized into
        flusher - the SerializableControl to manage the flushing
      • serializeString

        public static final void serializeString​(String value,
                                                 ByteBuffer buffer)
        Serialize the specified string into the specified buffer.
        Parameters:
        value - the string to be serialized
        buffer - the buffer to be serialized into
      • serializeSubstring

        public static final void serializeSubstring​(String value,
                                                    int offset,
                                                    int count,
                                                    ByteBuffer buffer,
                                                    SerializableControl flusher)
        Serialize a substring of a specified string into the specified buffer, flushing when necessary. The substring serialized is of the specified length and starts at the specified offset relative to supplied string. The specified SerializableControl manages any flushing required.
        Parameters:
        value - the string from which a substring is to be serialized
        offset - the start of the substring relative to supplied string
        count - the length of the substring
        buffer - the buffer to be serialized into
        flusher - the SerializableControl to manage the flushing
      • deserializeString

        public static final String deserializeString​(ByteBuffer buffer,
                                                     DeserializableControl control)
        Deserialize a string from the specified buffer. The specified DeserializableControl ensures sufficient bytes are available.
        Parameters:
        buffer - the buffer to serialize from
        control - the DeserializableControl
        Returns:
        the deserialized string
      • deserializeString

        public static final String deserializeString​(ByteBuffer buffer)
        Deserialize a string from the specified buffer.
        Parameters:
        buffer - the buffer to serialize from
        Returns:
        the deserialized string