Class EolCanonicalizingInputStream

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

    public class EolCanonicalizingInputStream
    extends java.io.InputStream
    An input stream which canonicalizes EOLs bytes on the fly to '\n'. Optionally, a binary check on the first 8000 bytes is performed and in case of binary files, canonicalization is turned off (for the complete file).
    • Constructor Summary

      Constructors 
      Constructor Description
      EolCanonicalizingInputStream​(java.io.InputStream in, boolean detectBinary)
      Creates a new InputStream, wrapping the specified stream
      EolCanonicalizingInputStream​(java.io.InputStream in, boolean detectBinary, boolean abortIfBinary)
      Creates a new InputStream, wrapping the specified stream
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      boolean isBinary()  
      int read()  
      int read​(byte[] bs, int off, int len)  
      • Methods inherited from class java.io.InputStream

        available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EolCanonicalizingInputStream

        public EolCanonicalizingInputStream​(java.io.InputStream in,
                                            boolean detectBinary)
        Creates a new InputStream, wrapping the specified stream
        Parameters:
        in - raw input stream
        detectBinary - whether binaries should be detected
        Since:
        2.0
      • EolCanonicalizingInputStream

        public EolCanonicalizingInputStream​(java.io.InputStream in,
                                            boolean detectBinary,
                                            boolean abortIfBinary)
        Creates a new InputStream, wrapping the specified stream
        Parameters:
        in - raw input stream
        detectBinary - whether binaries should be detected
        abortIfBinary - throw an IOException if the file is binary
        Since:
        3.3
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] bs,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • isBinary

        public boolean isBinary()
        Returns:
        true if the stream has detected as a binary so far
        Since:
        3.3
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException