Top Description Fields Constructors Methods
org.hsqldb.lib

public Class AsciiInputStream

extends InputStream
Class Inheritance
Imports
java.io.IOException, .InputStream, .Reader, java.util.Objects

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.
Author
Campbell Burnet (campbell-burnet@users dot sourceforge.net)
Since
2.7.1
Version
2.7.1

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
ASCII_MASK

is 0b01111111

public static final int
ASCII_MAX

is 2^7 - 1 (127)

private boolean
private int
public static final int
NON_ASCII_MIN

is 2^7 (128)

public static final int
private final Reader

Constructor Summary

AccessConstructor and Description
public
AsciiInputStream(final Reader
from which to read
reader
)

Constructs a new instance for the given reader.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Closes this input stream and releases any system resources associated with the stream.

public synchronized int

Returns:

the next byte of data, or -1 if the end of the stream is reached.
read
()

Implements abstract java.io.InputStream.read.

Reads the next byte of data from the input stream.

Inherited from java.io.InputStream:
availablemarkmarkSupportednullInputStreamreadreadreadAllBytesreadNBytesreadNBytesresetskipskipNBytestransferTo

Field Detail

ASCII_BITSback to summary
public static final int ASCII_BITS

is 7;

ASCII_MASKback to summary
public static final int ASCII_MASK

is 0b01111111

ASCII_MAXback to summary
public static final int ASCII_MAX

is 2^7 - 1 (127)

hasNextCharback to summary
private boolean hasNextChar
nextCharback to summary
private int nextChar
NON_ASCII_MINback to summary
public static final int NON_ASCII_MIN

is 2^7 (128)

NON_ASCII_REPLACEMENTback to summary
public static final int NON_ASCII_REPLACEMENT

is '?'

readerback to summary
private final Reader reader

Constructor Detail

AsciiInputStreamback to summary
public AsciiInputStream(final Reader reader)

Constructs a new instance for the given reader.

Parameters
reader:Reader

from which to read

Method Detail

closeback to summary
public void close() throws IOException

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Doc from java.io.InputStream.close.

Closes this input stream and releases any system resources associated with the stream.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
readback to summary
public synchronized int read() throws IOException

Implements abstract java.io.InputStream.read.

Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to ASCII_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 a NON_ASCII_REPLACEMENT value when read.

Surrogate pairs are correctly counted as a single character and produce a single NON_ASCII_REPLACEMENT value when read.

Returns:int

the next byte of data, or -1 if the end of the stream is reached.

Exceptions
IOException:
if an I/O error occurs.