net.i2p.sam

## Class UTF8Reader

- java.lang.Object
- - java.io.Reader
  - - net.i2p.sam.UTF8Reader

- All Implemented Interfaces:
    Closeable, AutoCloseable, Readable

      public class UTF8Reader
      extends Reader

  An unbuffered version of InputStreamReader. Does not read any extra characters, as long as input is well-formed. This permits the partial reading of an InputStream as UTF-8 and then passing the remainder of the input stream elsewhere. This isn't the most robust for malformed input, so it may not be appropriate for e.g. HTTP headers. Not thread-safe, obviously. May be moved to net.i2p.util if anybody else needs it.

- - ### Field Summary

    - ### Fields inherited from class java.io.Reader

      `lock`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UTF8Reader(InputStream in)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `int` | `read()`
    `int` | `read(char[] cbuf)`
    `int` | `read(char[] cbuf, int off, int len)`

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

      `mark, markSupported, read, ready, reset, skip`

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

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

- - ### Constructor Detail

    - #### UTF8Reader

          public UTF8Reader(InputStream in)

      Parameters:
        `in` - UTF-8

  - ### Method Detail

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in class `Reader`
      Throws:
        `IOException`

    - #### read

          public int read()
                   throws IOException

      Overrides:
        `read` in class `Reader`
      Returns:
        replacement character on decoding error
      Throws:
        `IOException`

    - #### read

          public int read(char[] cbuf)
                   throws IOException

      Overrides:
        `read` in class `Reader`
      Throws:
        `IOException`

    - #### read

          public int read(char[] cbuf,
                          int off,
                          int len)
                   throws IOException

      Specified by:
        `read` in class `Reader`
      Throws:
        `IOException`