Class ReversedLinesFileReader.FilePart

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private FilePart​(long no, int length, byte[] leftOverOfLastFilePart)
      ctor
    • Field Detail

      • no

        private final long no
      • data

        private final byte[] data
      • leftOver

        private byte[] leftOver
      • currentLastBytePos

        private int currentLastBytePos
    • Constructor Detail

      • FilePart

        private FilePart​(long no,
                         int length,
                         byte[] leftOverOfLastFilePart)
                  throws java.io.IOException
        ctor
        Parameters:
        no - the part number
        length - its length
        leftOverOfLastFilePart - remainder
        Throws:
        java.io.IOException - if there is a problem reading the file
    • Method Detail

      • createLeftOver

        private void createLeftOver()
        Creates the buffer containing any left over bytes.
      • getNewLineMatchByteCount

        private int getNewLineMatchByteCount​(byte[] data,
                                             int i)
        Finds the new-line sequence and return its length.
        Parameters:
        data - buffer to scan
        i - start offset in buffer
        Returns:
        length of newline sequence or 0 if none found
      • readLine

        private java.lang.String readLine()
                                   throws java.io.IOException
        Reads a line.
        Returns:
        the line or null
        Throws:
        java.io.IOException - if there is an error reading from the file
      • rollOver

        private ReversedLinesFileReader.FilePart rollOver()
                                                   throws java.io.IOException
        Handles block rollover
        Returns:
        the new FilePart or null
        Throws:
        java.io.IOException - if there was a problem reading the file