Class SeekableLineInputStream

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

    public class SeekableLineInputStream
    extends java.io.InputStream
    This stream searches all line end characters (hex 0A) in a file. For Linux line splitting is OK, for Windows the character hex 0D has to be eliminated with String.trim()
    • Field Detail

      • countsTotal

        private final long[] countsTotal
      • diffSum

        private final long[] diffSum
      • bufferSize

        private int bufferSize
      • lineEnds

        private final java.util.List<java.lang.Long> lineEnds
      • maxLineLength

        private long maxLineLength
    • Constructor Detail

      • SeekableLineInputStream

        public SeekableLineInputStream​(java.lang.String file)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • SeekableLineInputStream

        public SeekableLineInputStream​(java.io.File file)
                                throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • getMaxLineLength

        public long getMaxLineLength()
      • 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
      • getLineCount

        public int getLineCount()
      • read

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

        public java.lang.String getMostProbableDelimiter()
      • readLine

        public java.lang.String readLine​(int lineNumber)
                                  throws java.io.IOException
        Throws:
        java.io.IOException