Documentation of 'org.mapdb.DataIO' Java class
DataIO
org.mapdb

Class DataIO



  • public final class DataIO
    extends java.lang.Object
    Various IO classes and utilities..
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static byte[] fromHexa(java.lang.String s)
      Converts hexadecimal string into binary data
      static long getLong(byte[] buf, int pos) 
      static long getSixLong(byte[] buf, int pos) 
      static long hash(byte[] buf, int off, int len, long seed)
      Calculates XXHash64 from given byte[] buffer.
      static long hash(char[] buf, int off, int len, long seed)
      Calculates XXHash64 from given char[] buffer.
      static int intHash(int h) 
      static int longHash(long h) 
      static int nextPowTwo(int a) 
      static long nextPowTwo(long a) 
      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 packLongBidi(byte[] buf, int pos, long value) 
      static int packLongBidi(java.io.DataOutput out, long value) 
      static int packLongSize(long value)
      Calculate how much bytes packed long consumes.
      static void packRecid(java.io.DataOutput out, long value)
      Pack RECID into output stream with 3 bit checksum.
      static long parity16Get(long i) 
      static long parity16Set(long i) 
      static long parity1Get(long i) 
      static long parity1Set(long i) 
      static long parity3Get(long i) 
      static long parity3Set(long i) 
      static long parity4Get(long i) 
      static long parity4Set(long i) 
      static void putLong(byte[] buf, int pos, long v) 
      static void putSixLong(byte[] buf, int pos, long value) 
      static void readFully(java.io.InputStream in, byte[] data) 
      static java.lang.String toHexa(byte[] bb)
      Converts binary array into its hexadecimal representation.
      static int unpackInt(java.io.DataInput is)
      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.
      static long unpackLongBidi(byte[] bb, int pos) 
      static long unpackLongBidiReverse(byte[] bb, int pos) 
      static long unpackRecid(java.io.DataInput in)
      Unpack RECID value from the input stream with 3 bit checksum.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

    • 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
      • 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
      • packLongSize

        public static int packLongSize(long value)
        Calculate how much bytes packed long consumes.
        Parameters:
        value - to calculate
        Returns:
        number of bytes used in packed form
      • unpackRecid

        public static long unpackRecid(java.io.DataInput in)
                                throws java.io.IOException
        Unpack RECID value from the input stream with 3 bit checksum.
        Parameters:
        in - The input stream.
        Returns:
        The long value.
        Throws:
        java.io.IOException - in case of IO error
      • packRecid

        public static void packRecid(java.io.DataOutput out,
                                     long value)
                              throws java.io.IOException
        Pack RECID into output stream with 3 bit checksum. 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
      • 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 - DataOutput to put value into
        value - to be serialized, must be non-negative
        Throws:
        java.io.IOException - in case of IO error
      • longHash

        public static int longHash(long h)
      • intHash

        public static int intHash(int h)
      • packLongBidi

        public static int packLongBidi(java.io.DataOutput out,
                                       long value)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • packLongBidi

        public static int packLongBidi(byte[] buf,
                                       int pos,
                                       long value)
      • unpackLongBidi

        public static long unpackLongBidi(byte[] bb,
                                          int pos)
      • unpackLongBidiReverse

        public static long unpackLongBidiReverse(byte[] bb,
                                                 int pos)
      • getLong

        public static long getLong(byte[] buf,
                                   int pos)
      • putLong

        public static void putLong(byte[] buf,
                                   int pos,
                                   long v)
      • getSixLong

        public static long getSixLong(byte[] buf,
                                      int pos)
      • putSixLong

        public static void putSixLong(byte[] buf,
                                      int pos,
                                      long value)
      • nextPowTwo

        public static long nextPowTwo(long a)
      • nextPowTwo

        public static int nextPowTwo(int a)
      • readFully

        public static void readFully(java.io.InputStream in,
                                     byte[] data)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • parity1Set

        public static long parity1Set(long i)
      • parity1Get

        public static long parity1Get(long i)
      • parity3Set

        public static long parity3Set(long i)
      • parity3Get

        public static long parity3Get(long i)
      • parity4Set

        public static long parity4Set(long i)
      • parity4Get

        public static long parity4Get(long i)
      • parity16Set

        public static long parity16Set(long i)
      • parity16Get

        public static long parity16Get(long i)
      • toHexa

        public static java.lang.String toHexa(byte[] bb)
        Converts binary array into its hexadecimal representation.
        Parameters:
        bb - binary data
        Returns:
        hexadecimal string
      • fromHexa

        public static byte[] fromHexa(java.lang.String s)
        Converts hexadecimal string into binary data
        Parameters:
        s - hexadecimal string
        Returns:
        binary data
        Throws:
        java.lang.NumberFormatException - in case of string format error
      • hash

        public static long hash(byte[] buf,
                                int off,
                                int len,
                                long seed)

        Calculates XXHash64 from given byte[] buffer.

        This code comes from LZ4-Java created by Adrien Grand.

        Parameters:
        buf - to calculate hash from
        off - offset to start calculation from
        len - length of data to calculate hash
        seed - hash seed
        Returns:
        XXHash.
      • hash

        public static long hash(char[] buf,
                                int off,
                                int len,
                                long seed)

        Calculates XXHash64 from given char[] buffer.

        This code comes from LZ4-Java created by Adrien Grand.

        Parameters:
        buf - to calculate hash from
        off - offset to start calculation from
        len - length of data to calculate hash
        seed - hash seed
        Returns:
        XXHash.

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.