java.lang.Object
java.io.InputStream
org.hsqldb.lib.AsciiInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
An input stream that reads US-ASCII values from a Reader, in compliance
with the Java US_ASCII Charset encoder, including
utf-16-surrogate-pairs.
- Since:
- 2.7.1
- Author:
- Campbell Burnet (campbell-burnet@users dot sourceforge.net)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
is 7;static final int
is 0b01111111static final int
is 2^7 - 1 (127)static final int
is 2^7 (128)static final int
is '?' -
Constructor Summary
ConstructorsConstructorDescriptionAsciiInputStream
(Reader reader) Constructs a new instance for the given reader. -
Method Summary
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
ASCII_BITS
public static final int ASCII_BITSis 7;- See Also:
-
ASCII_MASK
public static final int ASCII_MASKis 0b01111111- See Also:
-
ASCII_MAX
public static final int ASCII_MAXis 2^7 - 1 (127)- See Also:
-
NON_ASCII_MIN
public static final int NON_ASCII_MINis 2^7 (128)- See Also:
-
NON_ASCII_REPLACEMENT
public static final int NON_ASCII_REPLACEMENTis '?'- See Also:
-
-
Constructor Details
-
AsciiInputStream
Constructs a new instance for the given reader.- Parameters:
reader
- from which to read
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
read
Reads the next byte of data from the input stream. The value byte is returned as anint
in the range0
toASCII_MAX
. If no byte is available because the end of the stream has been reached, the value-1
is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.UTF-16 characters above
ASCII_MAX
produce aNON_ASCII_REPLACEMENT
value when read.Surrogate pairs are correctly counted as a single character and produce a single
NON_ASCII_REPLACEMENT
value when read.- Specified by:
read
in classInputStream
- Returns:
- the next byte of data, or
-1
if the end of the stream is reached. - Throws:
IOException
- if an I/O error occurs.
-