Class RandomAccessReader

    • Constructor Detail

      • RandomAccessReader

        protected RandomAccessReader​(Rebufferer rebufferer)
        Only created through Builder
        Parameters:
        rebufferer - Rebufferer to use
    • Method Detail

      • reBuffer

        public void reBuffer()
        Read data from file starting from current currentOffset to populate buffer.
        Specified by:
        reBuffer in class RebufferingInputStream
      • current

        protected long current()
      • reset

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

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.InputStream
      • bytesPastMark

        public long bytesPastMark()
      • isEOF

        public boolean isEOF()
        Specified by:
        isEOF in interface FileDataInput
        Returns:
        true if there is no more data to read
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
      • toString

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

        public void seek​(long newPosition)
        Specified by:
        seek in interface FileDataInput
      • skipBytes

        public int skipBytes​(int n)
                      throws java.io.IOException
        Description copied from interface: DataInputPlus
        Always skips the requested number of bytes, unless EOF is reached
        Specified by:
        skipBytes in interface java.io.DataInput
        Specified by:
        skipBytes in interface DataInputPlus
        Overrides:
        skipBytes in class RebufferingInputStream
        Parameters:
        n - number of bytes to skip
        Returns:
        number of bytes skipped
        Throws:
        java.io.IOException
      • readLine

        public final java.lang.String readLine()
                                        throws java.io.IOException
        Reads a line of text form the current position in this file. A line is represented by zero or more characters followed by '\n', '\r', "\r\n" or the end of file marker. The string does not include the line terminating sequence.

        Blocks until a line terminating sequence has been read, the end of the file is reached or an exception is thrown.

        Specified by:
        readLine in interface java.io.DataInput
        Overrides:
        readLine in class RebufferingInputStream
        Returns:
        the contents of the line or null if no characters have been read before the end of the file has been reached.
        Throws:
        java.io.IOException - if this file is closed or another I/O error occurs.
      • length

        public long length()
      • getPosition

        public long getPosition()
      • getCrcCheckChance

        public double getCrcCheckChance()
      • open

        public static RandomAccessReader open​(File file)
        Open a RandomAccessReader (not compressed, not mmapped, no read throttling) that will own its channel.
        Parameters:
        file - File to open for reading
        Returns:
        new RandomAccessReader that owns the channel opened in this method.