Class UnixLineEndingInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.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 Summary

      Constructors 
      Constructor Description
      UnixLineEndingInputStream​(java.io.InputStream inputStream, boolean lineFeedAtEos)
      Constructs an input stream that filters another stream
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private int handleEos​(boolean previousWasSlashCr)
      Handles the end of stream condition.
      int read()
      private int readUpdate()
      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
    • Constructor Detail

      • UnixLineEndingInputStream

        public UnixLineEndingInputStream​(java.io.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 Detail

      • 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 java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • readUpdate

        private int readUpdate()
                        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 - If an I/O error occurs.