org.mapdb
Class DataInput2

java.lang.Object
  extended by java.io.InputStream
      extended by org.mapdb.DataInput2
All Implemented Interfaces:
Closeable, DataInput

public final class DataInput2
extends InputStream
implements DataInput

Wraps ByteBuffer and provides DataInput

Author:
Jan Kotek

Field Summary
 ByteBuffer buf
           
 int pos
           
 
Constructor Summary
DataInput2(byte[] b)
           
DataInput2(ByteBuffer buf, int pos)
           
 
Method Summary
 int read()
           
 boolean readBoolean()
           
 byte readByte()
           
 char readChar()
           
 double readDouble()
           
 float readFloat()
           
 void readFully(byte[] b)
           
 void readFully(byte[] b, int off, int len)
           
 int readInt()
           
 String readLine()
           
 long readLong()
           
 short readShort()
           
 int readUnsignedByte()
           
 int readUnsignedShort()
           
 String readUTF()
           
 int skipBytes(int n)
           
static int unpackInt(DataInput is)
          Unpack positive int value from the input stream.
static long unpackLong(DataInput in)
          Unpack positive long value from the input stream.
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buf

public ByteBuffer buf

pos

public int pos
Constructor Detail

DataInput2

public DataInput2(ByteBuffer buf,
                  int pos)

DataInput2

public DataInput2(byte[] b)
Method Detail

readFully

public void readFully(byte[] b)
               throws IOException
Specified by:
readFully in interface DataInput
Throws:
IOException

readFully

public void readFully(byte[] b,
                      int off,
                      int len)
               throws IOException
Specified by:
readFully in interface DataInput
Throws:
IOException

skipBytes

public int skipBytes(int n)
              throws IOException
Specified by:
skipBytes in interface DataInput
Throws:
IOException

readBoolean

public boolean readBoolean()
                    throws IOException
Specified by:
readBoolean in interface DataInput
Throws:
IOException

readByte

public byte readByte()
              throws IOException
Specified by:
readByte in interface DataInput
Throws:
IOException

readUnsignedByte

public int readUnsignedByte()
                     throws IOException
Specified by:
readUnsignedByte in interface DataInput
Throws:
IOException

readShort

public short readShort()
                throws IOException
Specified by:
readShort in interface DataInput
Throws:
IOException

readUnsignedShort

public int readUnsignedShort()
                      throws IOException
Specified by:
readUnsignedShort in interface DataInput
Throws:
IOException

readChar

public char readChar()
              throws IOException
Specified by:
readChar in interface DataInput
Throws:
IOException

readInt

public int readInt()
            throws IOException
Specified by:
readInt in interface DataInput
Throws:
IOException

readLong

public long readLong()
              throws IOException
Specified by:
readLong in interface DataInput
Throws:
IOException

readFloat

public float readFloat()
                throws IOException
Specified by:
readFloat in interface DataInput
Throws:
IOException

readDouble

public double readDouble()
                  throws IOException
Specified by:
readDouble in interface DataInput
Throws:
IOException

readLine

public String readLine()
                throws IOException
Specified by:
readLine in interface DataInput
Throws:
IOException

readUTF

public String readUTF()
               throws IOException
Specified by:
readUTF in interface DataInput
Throws:
IOException

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
IOException

unpackInt

public static int unpackInt(DataInput is)
                     throws IOException
Unpack positive int value from the input stream. This method originally comes from Kryo Framework, author Nathan Sweet. It was modified to fit MapDB needs.

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

unpackLong

public static long unpackLong(DataInput in)
                       throws IOException
Unpack positive long value from the input stream. This method 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


Copyright © 2014. All Rights Reserved.