Class SerializationUtil


  • public final class SerializationUtil
    extends Object
    Serialization utilities.
    • Method Detail

      • packInt

        public static void packInt​(int value,
                                   DataOutput out)
                            throws IOException
        Pack non-negative long into output stream. It will occupy 1-5 bytes depending on value (lower values occupy smaller space)

        This method has been borrowed from MapDB but originally comes from Kryo Framework, author Nathan Sweet. It was modified to fit MapDB needs.

        Parameters:
        value - to be serialized, must be non-negative
        out - DataOutput to put value into
        Throws:
        IOException
      • unpackInt

        public static int unpackInt​(DataInput in)
                             throws IOException
        Unpack positive int value from the input stream.

        This method has been borrowed from MapDB but originally comes from Kryo Framework, author Nathan Sweet. It was modified to fit MapDB needs.

        Parameters:
        in - The input stream.
        Returns:
        The long value.
        Throws:
        IOException
      • packLong

        public static void packLong​(long value,
                                    DataOutput out)
                             throws IOException
        Pack non-negative long into output stream. It will occupy 1-10 bytes depending on value (lower values occupy smaller space)

        This method has been borrowed from MapDB but originally comes from Kryo Framework, author Nathan Sweet. It was modified to fit MapDB needs.

        Parameters:
        value - to be serialized, must be non-negative
        out - DataOutput to put value into
        Throws:
        IOException
      • unpackLong

        public static long unpackLong​(DataInput in)
                               throws IOException
        Unpack positive long value from the input stream.

        This method has been borrowed from MapDB but originally comes from Kryo Framework, author Nathan Sweet. It was modified to fit MapDB needs.

        Parameters:
        in - The input stream.
        Returns:
        The long value.
        Throws:
        IOException