Package org.basex.io.in
Class TextInput
java.lang.Object
java.io.InputStream
org.basex.io.in.BufferInput
org.basex.io.in.TextInput
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
NewlineInput
This class provides buffered access to textual input.
The input encoding will initially be guessed by analyzing the first bytes;
it can also be explicitly set by calling
encoding().
UTF-8 will be used as default encoding.- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Constructor Summary
ConstructorsConstructorDescriptionTextInput(byte[] token) Constructor.TextInput(InputStream is) Constructor.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal TokenBuildercache()Retrieves the whole text and closes the stream.final byte[]content()Retrieves and returns the whole data and closes the stream.final Stringencoding()Returns the encoding.Sets a new encoding.intread()Returns the next codepoint.final TextInputvalidate(boolean flag) Checks the input for valid XML characters and throws an exception if invalid characters are found.Methods inherited from class org.basex.io.in.BufferInput
close, get, get, io, length, mark, markSupported, readBytes, readString, reset, sizeMethods inherited from class java.io.InputStream
available, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, skip, skipNBytes, transferTo
-
Constructor Details
-
TextInput
Constructor.- Parameters:
is- input stream- Throws:
IOException- I/O exception
-
TextInput
Constructor.- Parameters:
io- input- Throws:
IOException- I/O exception
-
TextInput
Constructor.- Parameters:
token- token- Throws:
IOException- I/O exception
-
-
Method Details
-
encoding
Returns the encoding.- Returns:
- encoding
-
validate
Checks the input for valid XML characters and throws an exception if invalid characters are found.- Parameters:
flag- flag to be set- Returns:
- self reference
-
encoding
Sets a new encoding.- Parameters:
encoding- encoding (ignored ifnullor an empty string)- Returns:
- self reference
- Throws:
IOException- I/O Exception
-
read
Returns the next codepoint.- Overrides:
readin classBufferInput- Returns:
- next codepoint
- Throws:
IOException- I/O exception
-
content
Description copied from class:BufferInputRetrieves and returns the whole data and closes the stream.- Overrides:
contentin classBufferInput- Returns:
- contents
- Throws:
IOException- I/O exception
-
cache
Retrieves the whole text and closes the stream.- Returns:
- token builder instance
- Throws:
IOException- I/O exception
-