org.mapdb
Class DataIO
- java.lang.Object
-
- org.mapdb.DataIO
-
public final class DataIO extends java.lang.ObjectVarious IO classes and utilities..
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classDataIO.DataInputByteArrayDataInput on top ofbyte[]static classDataIO.DataInputByteBufferWrapsByteBufferand providesDataInputstatic interfaceDataIO.DataInputInternalGive access to internal byte[] or ByteBuffer in DataInput2..static classDataIO.DataInputToStreamWrapsDataInputintoInputStreamstatic classDataIO.DataOutputByteArrayProvidesDataOutputimplementation on top of growablebyte[]ByteArrayOutputStreamis not used as it requiresbyte[]copyingstatic classDataIO.HeartbeatFileLockFile locking mechanism.
-
Field Summary
Fields Modifier and Type Field and Description static longPACK_LONG_RESULT_MASK
-
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 datastatic longgetLong(byte[] buf, int pos)static longgetSixLong(byte[] buf, int pos)static longhash(byte[] buf, int off, int len, long seed)Calculates XXHash64 from givenbyte[]buffer.static longhash(char[] buf, int off, int len, long seed)Calculates XXHash64 from givenchar[]buffer.static intintHash(int h)static intlongHash(long h)static intnextPowTwo(int a)static longnextPowTwo(long a)static voidpackInt(java.io.DataOutput out, int value)Pack int into an output stream.static voidpackIntBigger(java.io.DataOutput out, int value)Pack int into an output stream.static voidpackLong(java.io.DataOutput out, long value)Pack long into output.static voidpackLong(java.io.OutputStream out, long value)Pack long into output.static intpackLongBidi(byte[] buf, int pos, long value)static intpackLongBidi(java.io.DataOutput out, long value)static intpackLongSize(long value)Calculate how much bytes packed long consumes.static voidpackRecid(java.io.DataOutput out, long value)Pack RECID into output stream with 3 bit checksum.static longparity16Get(long i)static longparity16Set(long i)static longparity1Get(long i)static longparity1Set(long i)static longparity3Get(long i)static longparity3Set(long i)static longparity4Get(long i)static longparity4Set(long i)static voidputLong(byte[] buf, int pos, long v)static voidputSixLong(byte[] buf, int pos, long value)static voidreadFully(java.io.InputStream in, byte[] data)static java.lang.StringtoHexa(byte[] bb)Converts binary array into its hexadecimal representation.static intunpackInt(java.io.DataInput is)Unpack int value from the input stream.static longunpackLong(java.io.DataInput in)Unpack long value from the input stream.static longunpackLong(java.io.InputStream in)Unpack long value from the input stream.static longunpackLongBidi(byte[] bb, int pos)static longunpackLongBidiReverse(byte[] bb, int pos)static longunpackRecid(java.io.DataInput in)Unpack RECID value from the input stream with 3 bit checksum.
-
-
-
Field Detail
-
PACK_LONG_RESULT_MASK
public static final long PACK_LONG_RESULT_MASK
- See Also:
- Constant Field Values
-
-
Method Detail
-
unpackInt
public static int unpackInt(java.io.DataInput is) throws java.io.IOExceptionUnpack 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.IOExceptionUnpack 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.IOExceptionUnpack 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.IOExceptionPack long into output. It will occupy 1-10 bytes depending on value (lower values occupy smaller space)- Parameters:
out- DataOutput to put value intovalue- 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.IOExceptionPack long into output. It will occupy 1-10 bytes depending on value (lower values occupy smaller space)- Parameters:
out- OutputStream to put value intovalue- 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.IOExceptionUnpack 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.IOExceptionPack 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 intovalue- 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.IOExceptionPack 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 intovalue- 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.IOExceptionPack int into an output stream. It will occupy 1-5 bytes depending on value (lower values occupy smaller space) This method is same aspackInt(DataOutput, int), but is optimized for values larger than 127. Usually it is recids.- Parameters:
out- DataOutput to put value intovalue- 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 fromoff- offset to start calculation fromlen- length of data to calculate hashseed- 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 fromoff- offset to start calculation fromlen- length of data to calculate hashseed- hash seed- Returns:
- XXHash.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG