org.basex.io
Class BufferInput

java.lang.Object
  extended by org.basex.io.BufferInput
Direct Known Subclasses:
CachedInput, DataInput

public class BufferInput
extends java.lang.Object

This class serves as a buffered wrapper for input streams.

Author:
Workgroup DBIS, University of Konstanz 2005-07, ISC License, Christian Gruen

Constructor Summary
BufferInput(byte[] buf)
          Empty constructor.
BufferInput(java.io.File file)
          Initializes the file reader.
BufferInput(java.io.File file, byte[] buf)
          Initializes the file reader.
BufferInput(java.lang.String file)
          Initializes the file reader.
BufferInput(java.lang.String file, byte[] buf)
          Initializes the file reader.
 
Method Summary
 void close()
          Closes the input stream.
 long length()
          Length of input.
 int read()
          Reads a single byte and returns it as integer.
 byte readByte()
          Returns the next byte.
 int size()
          Number of read bytes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferInput

public BufferInput(byte[] buf)
Empty constructor.

Parameters:
buf - buffer

BufferInput

public BufferInput(java.io.File file)
            throws java.io.IOException
Initializes the file reader.

Parameters:
file - the file to be read
Throws:
java.io.IOException - IO Exception

BufferInput

public BufferInput(java.io.File file,
                   byte[] buf)
            throws java.io.IOException
Initializes the file reader.

Parameters:
file - the file to be read
buf - input buffer
Throws:
java.io.IOException - IO Exception

BufferInput

public BufferInput(java.lang.String file)
            throws java.io.IOException
Initializes the file reader.

Parameters:
file - the file to be read
Throws:
java.io.IOException - IO Exception

BufferInput

public BufferInput(java.lang.String file,
                   byte[] buf)
            throws java.io.IOException
Initializes the file reader.

Parameters:
file - the file to be read
buf - input buffer
Throws:
java.io.IOException - IO Exception
Method Detail

close

public final void close()
                 throws java.io.IOException
Closes the input stream.

Throws:
java.io.IOException - IO Exception

length

public final long length()
Length of input.

Returns:
read bytes

read

public final int read()
Reads a single byte and returns it as integer.

Returns:
read byte

readByte

public byte readByte()
Returns the next byte.

Returns:
next byte

size

public final int size()
Number of read bytes.

Returns:
read bytes