org.h2.store
Class DataReader

java.lang.Object
  extended by java.io.Reader
      extended by org.h2.store.DataReader
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable

public class DataReader
extends java.io.Reader

This class is backed by an input stream and supports reading values and variable size data.


Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
DataReader(java.io.InputStream in)
          Create a new data reader.
 
Method Summary
 void close()
           
 int read(char[] buff, int off, int len)
           
 byte readByte()
          Read a byte.
 void readFully(byte[] buff, int offset, int len)
          Read a number of bytes.
 java.lang.String readString()
          Read a string from the stream.
 int readVarInt()
          Read a variable size integer.
 long readVarLong()
          Read a variable size long.
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataReader

public DataReader(java.io.InputStream in)
Create a new data reader.

Parameters:
in - the input stream
Method Detail

readByte

public byte readByte()
              throws java.io.IOException
Read a byte.

Returns:
the byte
Throws:
java.io.IOException

readVarInt

public int readVarInt()
               throws java.io.IOException
Read a variable size integer.

Returns:
the value
Throws:
java.io.IOException

readVarLong

public long readVarLong()
                 throws java.io.IOException
Read a variable size long.

Returns:
the value
Throws:
java.io.IOException

readFully

public void readFully(byte[] buff,
                      int offset,
                      int len)
               throws java.io.IOException
Read a number of bytes.

Parameters:
buff - the target buffer
offset - the offset within the target buffer
len - the number of bytes to read
Throws:
java.io.IOException

readString

public java.lang.String readString()
                            throws java.io.IOException
Read a string from the stream.

Returns:
the string
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Reader
Throws:
java.io.IOException

read

public int read(char[] buff,
                int off,
                int len)
         throws java.io.IOException
Specified by:
read in class java.io.Reader
Throws:
java.io.IOException