Class SeekableBufferedReader

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

    public class SeekableBufferedReader
    extends java.io.BufferedReader
    A buffered reader for a file. It allows to 'seek' and 'readLine()'
    Author:
    pablocingolani
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_BUFFER_SIZE  
      • Fields inherited from class java.io.Reader

        lock
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      boolean equals​(java.lang.Object arg0)  
      long getFilePointer()  
      int hashCode()  
      void mark​(int readAheadLimit)  
      boolean markSupported()  
      void open​(java.lang.String fileName)  
      int read()  
      int read​(char[] buff)  
      int read​(char[] cbuf, int off, int len)  
      int read​(java.nio.CharBuffer arg0)  
      java.lang.String readLine()  
      boolean ready()  
      void reset()  
      void seek​(long pos)
      Seek to a position in the file
      long skip​(long n)  
      java.lang.String toString()  
      • Methods inherited from class java.io.BufferedReader

        lines
      • Methods inherited from class java.io.Reader

        nullReader, transferTo
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • DEFAULT_BUFFER_SIZE

        public static int DEFAULT_BUFFER_SIZE
    • Constructor Detail

      • SeekableBufferedReader

        public SeekableBufferedReader​(java.lang.String fileName)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • SeekableBufferedReader

        public SeekableBufferedReader​(java.lang.String fileName,
                                      int bufferSize)
                               throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • 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.BufferedReader
        Throws:
        java.io.IOException
      • equals

        public boolean equals​(java.lang.Object arg0)
        Overrides:
        equals in class java.lang.Object
      • getFilePointer

        public long getFilePointer()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • mark

        public void mark​(int readAheadLimit)
                  throws java.io.IOException
        Overrides:
        mark in class java.io.BufferedReader
        Throws:
        java.io.IOException
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.BufferedReader
      • open

        public void open​(java.lang.String fileName)
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public int read()
                 throws java.io.IOException
        Overrides:
        read in class java.io.BufferedReader
        Throws:
        java.io.IOException
      • read

        public int read​(char[] buff)
                 throws java.io.IOException
        Overrides:
        read in class java.io.Reader
        Throws:
        java.io.IOException
      • read

        public int read​(char[] cbuf,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.BufferedReader
        Throws:
        java.io.IOException
      • read

        public int read​(java.nio.CharBuffer arg0)
                 throws java.io.IOException
        Specified by:
        read in interface java.lang.Readable
        Overrides:
        read in class java.io.Reader
        Throws:
        java.io.IOException
      • readLine

        public java.lang.String readLine()
                                  throws java.io.IOException
        Overrides:
        readLine in class java.io.BufferedReader
        Throws:
        java.io.IOException
      • ready

        public boolean ready()
                      throws java.io.IOException
        Overrides:
        ready in class java.io.BufferedReader
        Throws:
        java.io.IOException
      • reset

        public void reset()
                   throws java.io.IOException
        Overrides:
        reset in class java.io.BufferedReader
        Throws:
        java.io.IOException
      • seek

        public void seek​(long pos)
                  throws java.io.IOException
        Seek to a position in the file
        Throws:
        java.io.IOException
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Overrides:
        skip in class java.io.BufferedReader
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object