Package org.basex.io.in
Class NewlineInput
java.lang.Object
java.io.InputStream
org.basex.io.in.BufferInput
org.basex.io.in.TextInput
org.basex.io.in.NewlineInput
- All Implemented Interfaces:
Closeable,AutoCloseable
This class provides a convenient access to text input. System dependent
line breaks (
\r\n, \n, \r) will be normalized to
newline characters \n, and the input encoding will be guessed by
analyzing the first bytes.- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Constructor Summary
ConstructorsConstructorDescriptionNewlineInput(byte[] token) Constructor.Constructor.NewlineInput(IO in) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionSets a new encoding.intread()Returns the next codepoint.readLine()Reads and returns a single line.booleanreadLine(TokenBuilder tb) Copies a single line to the specified token builder.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
-
NewlineInput
Constructor.- Parameters:
is- input stream- Throws:
IOException- I/O exception
-
NewlineInput
Constructor.- Parameters:
in- input- Throws:
IOException- I/O exception
-
NewlineInput
Constructor.- Parameters:
token- token- Throws:
IOException- I/O exception
-
-
Method Details
-
encoding
Description copied from class:TextInputSets a new encoding.- Overrides:
encodingin classTextInput- Parameters:
encoding- encoding (ignored ifnullor an empty string)- Returns:
- self reference
- Throws:
IOException- I/O Exception
-
read
Description copied from class:TextInputReturns the next codepoint.- Overrides:
readin classTextInput- Returns:
- next codepoint
- Throws:
IOException- I/O exception
-
readLine
Reads and returns a single line.- Returns:
- line or
null - Throws:
IOException- I/O exception
-
readLine
Copies a single line to the specified token builder.- Parameters:
tb- token builder to be filled- Returns:
trueif more input was found- Throws:
IOException- I/O exception
-