org.apache.commons.io.input
Class ReversedLinesFileReader.FilePart

java.lang.Object
  extended by org.apache.commons.io.input.ReversedLinesFileReader.FilePart
Enclosing class:
ReversedLinesFileReader

private class ReversedLinesFileReader.FilePart
extends java.lang.Object


Field Summary
private  int currentLastBytePos
           
private  byte[] data
           
private  byte[] leftOver
           
private  long no
           
 
Constructor Summary
private ReversedLinesFileReader.FilePart(long no, int length, byte[] leftOverOfLastFilePart)
          ctor
 
Method Summary
private  void createLeftOver()
          Creates the buffer containing any left over bytes.
private  int getNewLineMatchByteCount(byte[] data, int i)
          Finds the new-line sequence and return its length.
private  java.lang.String readLine()
          Reads a line.
private  ReversedLinesFileReader.FilePart rollOver()
          Handles block rollover
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

no

private final long no

data

private final byte[] data

leftOver

private byte[] leftOver

currentLastBytePos

private int currentLastBytePos
Constructor Detail

ReversedLinesFileReader.FilePart

private ReversedLinesFileReader.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

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

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

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


Copyright (c) 2002-2013 Apache Software Foundation