Module org.hsqldb
Package org.hsqldb.lib

## Class AsciiInputStream

- java.lang.Object
- - java.io.InputStream
  - - org.hsqldb.lib.AsciiInputStream

- All Implemented Interfaces:
    `java.io.Closeable`, `java.lang.AutoCloseable`

      public class AsciiInputStream
      extends java.io.InputStream

  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

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `ASCII_BITS` | is 7;
    `static int` | `ASCII_MASK` | is 0b01111111
    `static int` | `ASCII_MAX` | is 2^7 - 1 (127)
    `static int` | `NON_ASCII_MIN` | is 2^7 (128)
    `static int` | `NON_ASCII_REPLACEMENT` | is '?'

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AsciiInputStream​(java.io.Reader reader)` | Constructs a new instance for the given reader.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `close()` |
    `int` | `read()` | Reads the next byte of data from the input stream.

    - ### Methods inherited from class java.io.InputStream

      `available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ASCII_BITS

          public static final int ASCII_BITS

      is 7;
      See Also:
        Constant Field Values

    - #### ASCII_MASK

          public static final int ASCII_MASK

      is 0b01111111
      See Also:
        Constant Field Values

    - #### ASCII_MAX

          public static final int ASCII_MAX

      is 2^7 - 1 (127)
      See Also:
        Constant Field Values

    - #### NON_ASCII_MIN

          public static final int NON_ASCII_MIN

      is 2^7 (128)
      See Also:
        Constant Field Values

    - #### NON_ASCII_REPLACEMENT

          public static final int NON_ASCII_REPLACEMENT

      is '?'
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AsciiInputStream

          public AsciiInputStream​(java.io.Reader reader)

      Constructs a new instance for the given reader.
      Parameters:
        `reader` - from which to read

  - ### Method Detail

    - #### close

          public void close()
                     throws java.io.IOException

      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Specified by:
        `close` in interface `java.io.Closeable`
      Overrides:
        `close` in class `java.io.InputStream`
      Throws:
        `java.io.IOException`

    - #### read

          public int read()
                   throws java.io.IOException

      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.

      Specified by:
        `read` in class `java.io.InputStream`
      Returns:
        the next byte of data, or `-1` if the end of the stream is reached.
      Throws:
        `java.io.IOException` - if an I/O error occurs.