org.basex.io.in
Class DataInput

java.lang.Object
  extended by java.io.InputStream
      extended by org.basex.io.in.BufferInput
          extended by org.basex.io.in.DataInput
All Implemented Interfaces:
java.io.Closeable

public final class DataInput
extends BufferInput

This is an input stream for project specific data types. It bears resemblance to Java's DataInputStream.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Field Summary
 
Fields inherited from class org.basex.io.in.BufferInput
bpos, bsize, buffer, input, length
 
Constructor Summary
DataInput(IO io)
          Constructor.
 
Method Summary
 boolean readBool()
          Reads a boolean value.
 IntList readDiffs()
          Reads a distance-mapped integer array.
 double readDouble()
          Reads a double value.
 long[] readLongs(int s)
          Reads an array of long values.
 int readNum()
          Reads a compressed integer value; see Num for more.
 int[] readNums()
          Reads a compressed integer array.
 byte[] readToken()
          Reads a token, represented by its compressed length and its byte array.
 byte[][] readTokens()
          Reads a token array.
 
Methods inherited from class org.basex.io.in.BufferInput
close, content, io, length, mark, markSupported, read, readByte, readBytes, readString, reset, size
 
Methods inherited from class java.io.InputStream
available, read, read, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataInput

public DataInput(IO io)
          throws java.io.IOException
Constructor.

Parameters:
io - the input to be read
Throws:
java.io.IOException - I/O Exception
Method Detail

readBool

public boolean readBool()
                 throws java.io.IOException
Reads a boolean value.

Returns:
boolean value
Throws:
java.io.IOException - I/O Exception

readToken

public byte[] readToken()
                 throws java.io.IOException
Reads a token, represented by its compressed length and its byte array.

Returns:
byte array
Throws:
java.io.IOException - I/O Exception

readDouble

public double readDouble()
                  throws java.io.IOException
Reads a double value.

Returns:
byte array
Throws:
java.io.IOException - I/O Exception

readDiffs

public IntList readDiffs()
                  throws java.io.IOException
Reads a distance-mapped integer array.

Returns:
integer array
Throws:
java.io.IOException - I/O Exception

readNums

public int[] readNums()
               throws java.io.IOException
Reads a compressed integer array.

Returns:
integer array
Throws:
java.io.IOException - I/O Exception

readTokens

public byte[][] readTokens()
                    throws java.io.IOException
Reads a token array.

Returns:
double array
Throws:
java.io.IOException - I/O Exception

readNum

public int readNum()
            throws java.io.IOException
Reads a compressed integer value; see Num for more.

Returns:
read value
Throws:
java.io.IOException - I/O Exception

readLongs

public long[] readLongs(int s)
                 throws java.io.IOException
Reads an array of long values.

Parameters:
s - array size
Returns:
array of longs
Throws:
java.io.IOException - I/O Exception