WindowsLineEndingInputStream (Commons IO 2.5)
Date: 2016-12-01

org.apache.commons.io.input

## Class WindowsLineEndingInputStream

- java.lang.Object
- - java.io.InputStream
  - - org.apache.commons.io.input.WindowsLineEndingInputStream

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

      public class WindowsLineEndingInputStream
      extends java.io.InputStream

  A filtering input stream that ensures the content will have windows line endings, CRLF.
  Since:
    2.5

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private boolean` | `ensureLineFeedAtEndOfFile`
    `private boolean` | `eofSeen`
    `private boolean` | `injectSlashN`
    `private boolean` | `slashNSeen`
    `private boolean` | `slashRSeen`
    `private java.io.InputStream` | `target`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WindowsLineEndingInputStream(java.io.InputStream in, boolean ensureLineFeedAtEndOfFile)` Create an input stream that filters another stream

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes the stream.
    `private int` | `eofGame()` Handles the eof-handling at the end of the stream
    `void` | `mark(int readlimit)`
    `int` | `read()`
    `private int` | `readWithUpdate()` Reads the next item from the target, updating internal flags in the process

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

      `available, markSupported, read, read, reset, skip`

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

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

- - ### Field Detail

    - #### slashRSeen

          private boolean slashRSeen

    - #### slashNSeen

          private boolean slashNSeen

    - #### injectSlashN

          private boolean injectSlashN

    - #### eofSeen

          private boolean eofSeen

    - #### target

          private final java.io.InputStream target

    - #### ensureLineFeedAtEndOfFile

          private final boolean ensureLineFeedAtEndOfFile

  - ### Constructor Detail

    - #### WindowsLineEndingInputStream

          public WindowsLineEndingInputStream(java.io.InputStream in,
                                      boolean ensureLineFeedAtEndOfFile)

      Create an input stream that filters another stream
      Parameters:
        `in` - The input stream to wrap
        `ensureLineFeedAtEndOfFile` - true to ensure that the file ends with CRLF

  - ### Method Detail

    - #### readWithUpdate

          private int readWithUpdate()
                              throws java.io.IOException

      Reads the next item from the target, updating internal flags in the process
      Returns:
        the next int read from the target stream
      Throws:
        `java.io.IOException` - upon error

    - #### read

          public int read()
                   throws java.io.IOException

      Specified by:
        `read` in class `java.io.InputStream`
      Throws:
        `java.io.IOException`

    - #### eofGame

          private int eofGame()

      Handles the eof-handling at the end of the stream
      Returns:
        The next char to output to the stream

    - #### close

          public void close()
                     throws java.io.IOException

      Closes the stream. Also closes the underlying stream.
      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Overrides:
        `close` in class `java.io.InputStream`
      Throws:
        `java.io.IOException` - upon error

    - #### mark

          public void mark(int readlimit)

      Overrides:
        `mark` in class `java.io.InputStream`

Copyright (c) 2002-2016 Apache Software Foundation