edu.northwestern.at.utils

## Class WhitespaceTrimmingBufferedReader

- java.lang.Object
- - java.io.Reader
  - - java.io.BufferedReader
    - - edu.northwestern.at.utils.WhitespaceTrimmingBufferedReader

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

      public class WhitespaceTrimmingBufferedReader
      extends java.io.BufferedReader

  A BufferedReader that trims whitespace from input lines.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected char[]` | `lineBuffer` Hold characters in current input line.
    `protected int` | `lineLength` Length of current input line.
    `protected int` | `lineOffset` Current offset in current input line.
    `protected char[]` | `oneCharBuffer` Single character buffer.

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

      `lock`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WhitespaceTrimmingBufferedReader(java.io.Reader reader)` Wrap existing reader with a whitespace trimming reader.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `read()` Read a single character.
    `int` | `read(char[] buffer, int offset, int length)` Read characters into a portion of an array.
    `java.lang.String` | `readLine()` Read a line of text.

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

      `close, mark, markSupported, ready, reset, skip`

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

      `read, read`

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

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

- - ### Field Detail

    - #### oneCharBuffer

          protected char[] oneCharBuffer

      Single character buffer.

    - #### lineBuffer

          protected char[] lineBuffer

      Hold characters in current input line.

    - #### lineOffset

          protected int lineOffset

      Current offset in current input line.

    - #### lineLength

          protected int lineLength

      Length of current input line.

  - ### Constructor Detail

    - #### WhitespaceTrimmingBufferedReader

          public WhitespaceTrimmingBufferedReader(java.io.Reader reader)

      Wrap existing reader with a whitespace trimming reader.
      Parameters:
        `reader` - Reader to wrap.

  - ### Method Detail

    - #### read

          public int read()
                   throws java.io.IOException

      Read a single character.
      Overrides:
        `read` in class `java.io.BufferedReader`
      Returns:
        The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reached.
      Throws:
        `java.io.IOException` - when an I/O error occurs.

    - #### read

          public int read(char[] buffer,
                 int offset,
                 int length)
                   throws java.io.IOException

      Read characters into a portion of an array.
      Overrides:
        `read` in class `java.io.BufferedReader`
      Parameters:
        `buffer` - Destination buffer.
        `offset` - Offset at which to start storing characters.
        `length` - Maximum number of characters to read.
      Returns:
        The number of characters read, or -1 if the end of the stream has been reached.
      Throws:
        `java.io.IOException` - when an I/O error occurs.

    - #### readLine

          public java.lang.String readLine()
                                    throws java.io.IOException

      Read a line of text.
      Overrides:
        `readLine` in class `java.io.BufferedReader`
      Returns:
        A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached.
      Throws:
        `java.io.IOException` - when an I/O error occurs.