Class UnixLineEndingInputStream

All Implemented Interfaces:
Closeable, AutoCloseable

public class UnixLineEndingInputStream extends AbstractLineEndingInputStream
A filtering input stream that ensures the content will have UNIX-style line endings, LF.
Since:
2.5
  • Constructor Details

    • UnixLineEndingInputStream

      public UnixLineEndingInputStream(InputStream inputStream, boolean lineFeedAtEos)
      Constructs an input stream that filters another stream
      Parameters:
      inputStream - The input stream to wrap.
      lineFeedAtEos - true to ensure that the file ends with LF.
  • Method Details

    • handleEos

      private int handleEos(boolean previousWasSlashCr)
      Handles the end of stream condition.
      Parameters:
      previousWasSlashCr - Indicates if the last seen was a \r.
      Returns:
      The next char to output to the stream.
    • read

      public int read() throws IOException
      Specified by:
      read in class InputStream
      Throws:
      IOException
    • readUpdate

      private int readUpdate() throws IOException
      Reads the next item from the target, updating internal flags in the process
      Returns:
      the next int read from the target stream.
      Throws:
      IOException - If an I/O error occurs.