Class ElsaUtil


  • public final class ElsaUtil
    extends java.lang.Object
    Utilities for Elsa Serialization
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ElsaUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Class[] findUnknownClasses​(java.lang.Object e)  
      static java.lang.Class[] findUnknownClassesInCollection​(java.lang.Iterable e)
      Serializes content of iterable to find unknown classes.
      static void packInt​(java.io.DataOutput out, int value)
      Pack int into an output stream.
      static void packIntBigger​(java.io.DataOutput out, int value)
      Pack int into an output stream.
      static void packLong​(java.io.DataOutput out, long value)
      Pack long into output.
      static void packLong​(java.io.OutputStream out, long value)
      Pack long into output.
      static int unpackInt​(java.io.DataInput is)
      Unpack int value from the input stream.
      static int unpackInt​(java.io.InputStream in)
      Unpack int value from the input stream.
      static long unpackLong​(java.io.DataInput in)
      Unpack long value from the input stream.
      static long unpackLong​(java.io.InputStream in)
      Unpack long value from the input stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ElsaUtil

        private ElsaUtil()
    • Method Detail

      • unpackInt

        public static int unpackInt​(java.io.DataInput is)
                             throws java.io.IOException
        Unpack int value from the input stream.
        Parameters:
        is - The input stream.
        Returns:
        The long value.
        Throws:
        java.io.IOException - in case of IO error
      • unpackLong

        public static long unpackLong​(java.io.DataInput in)
                               throws java.io.IOException
        Unpack long value from the input stream.
        Parameters:
        in - The input stream.
        Returns:
        The long value.
        Throws:
        java.io.IOException - in case of IO error
      • unpackInt

        public static int unpackInt​(java.io.InputStream in)
                             throws java.io.IOException
        Unpack int value from the input stream.
        Parameters:
        in - The input stream.
        Returns:
        The long value.
        Throws:
        java.io.IOException - in case of IO error
      • unpackLong

        public static long unpackLong​(java.io.InputStream in)
                               throws java.io.IOException
        Unpack long value from the input stream.
        Parameters:
        in - The input stream.
        Returns:
        The long value.
        Throws:
        java.io.IOException - in case of IO error
      • packLong

        public static void packLong​(java.io.DataOutput out,
                                    long value)
                             throws java.io.IOException
        Pack long into output. It will occupy 1-10 bytes depending on value (lower values occupy smaller space)
        Parameters:
        out - DataOutput to put value into
        value - to be serialized, must be non-negative
        Throws:
        java.io.IOException - in case of IO error
      • packLong

        public static void packLong​(java.io.OutputStream out,
                                    long value)
                             throws java.io.IOException
        Pack long into output. It will occupy 1-10 bytes depending on value (lower values occupy smaller space)
        Parameters:
        out - OutputStream to put value into
        value - to be serialized, must be non-negative
        Throws:
        java.io.IOException - in case of IO error
      • packInt

        public static void packInt​(java.io.DataOutput out,
                                   int value)
                            throws java.io.IOException
        Pack int into an output stream. It will occupy 1-5 bytes depending on value (lower values occupy smaller space)
        Parameters:
        out - DataOutput to put value into
        value - to be serialized, must be non-negative
        Throws:
        java.io.IOException - in case of IO error
      • packIntBigger

        public static void packIntBigger​(java.io.DataOutput out,
                                         int value)
                                  throws java.io.IOException
        Pack int into an output stream. It will occupy 1-5 bytes depending on value (lower values occupy smaller space) This method is same as packInt(DataOutput, int), but is optimized for values larger than 127. Usually it is recids.
        Parameters:
        out - String to put value into
        value - to be serialized, must be non-negative
        Throws:
        java.io.IOException - in case of IO error
      • findUnknownClassesInCollection

        public static java.lang.Class[] findUnknownClassesInCollection​(java.lang.Iterable e)
        Serializes content of iterable to find unknown classes. That can be passed to ElsaMaker.registerClasses(Class[]) }
        Parameters:
        e - iterable over objects, whose object graph will be checked
        Returns:
        array of unknown classes found in object graph
      • findUnknownClasses

        public static java.lang.Class[] findUnknownClasses​(java.lang.Object e)