Package org.basex.io.in
Class XMLInput
java.lang.Object
java.io.InputStream
org.basex.io.in.XMLInput
- All Implemented Interfaces:
Closeable,AutoCloseable
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-21, BSD License, Christian Gruen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(byte[] value, boolean spaces) Inserts some bytes in the input stream.voidclose()voidSets a new encoding.io()Returns the IO reference.longlength()Returns the file length.intline()Returns the current line.intpos()Returns the current file position.voidprev(int p) Jumps the specified number of characters back.intread()Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
XMLInput
Constructor.- Parameters:
io- input reference- Throws:
IOException- I/O exception
-
-
Method Details
-
encoding
Sets a new encoding.- Parameters:
e- encoding- Throws:
IOException- I/O exception
-
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
- Specified by:
readin classInputStream- Throws:
IOException
-
add
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
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein 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
-