Package org.basex.io.in
Class XMLInput
- java.lang.Object
-
- java.io.InputStream
-
- org.basex.io.in.XMLInput
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class XMLInput extends 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-24, BSD License, Christian Gruen
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(byte[] value, boolean spaces)
Inserts some bytes in the input stream.void
close()
void
encoding(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, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
XMLInput
public XMLInput(IO io) throws IOException
Constructor.- Parameters:
io
- input reference- Throws:
IOException
- I/O exception
-
-
Method Detail
-
encoding
public void encoding(String e) throws IOException
Sets a new encoding.- Parameters:
e
- encoding- Throws:
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 IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
add
public boolean add(byte[] value, boolean spaces) throws IOException
Inserts some bytes in the input stream.- Parameters:
value
- values to insertspaces
- add spaces- Returns:
- true if everything went alright
- Throws:
IOException
- I/O exception
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
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
-
-