org.basex.io.in
Class XMLInput

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

public class XMLInput
extends java.io.InputStream

This class provides methods for reading XML input and recursive entities. The input encoding will be guessed by analyzing the first bytes.

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

Constructor Summary
XMLInput(IO io)
          Constructor.
 
Method Summary
 boolean add(byte[] val, boolean s)
          Inserts some bytes in the input stream.
 void close()
           
 void encoding(java.lang.String e)
          Sets a new encoding.
 IO io()
          Returns the IO reference.
 long length()
          Returns the file length.
 int line()
          Returns the current line.
 int pos()
          Returns the current file position.
 void prev(int p)
          Jumps the specified number of characters back.
 int read()
           
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLInput

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

Parameters:
io - input reference
Throws:
java.io.IOException - I/O exception
Method Detail

encoding

public void encoding(java.lang.String e)
              throws java.io.IOException
Sets a new encoding.

Parameters:
e - encoding
Throws:
java.io.IOException - I/O exception

io

public IO io()
Returns the IO reference.

Returns:
file reference

prev

public void prev(int p)
Jumps the specified number of characters back.

Parameters:
p - number of characters

read

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

add

public boolean add(byte[] val,
                   boolean s)
            throws java.io.IOException
Inserts some bytes in the input stream.

Parameters:
val - values to insert
s - add spaces
Returns:
true if everything went alright
Throws:
java.io.IOException - I/O exception

close

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

pos

public int pos()
Returns the current file position.

Returns:
file position

line

public int line()
Returns the current line.

Returns:
line

length

public long length()
Returns the file length.

Returns:
file position