org.nuiton.util
Class ReverseFileReader

java.lang.Object
  extended by org.nuiton.util.ReverseFileReader
All Implemented Interfaces:
java.io.Closeable

public class ReverseFileReader
extends java.lang.Object
implements java.io.Closeable

Reverse file reader.

Version:
$Revision: 1830 $ TODO add an interface on it. Last update : $Date: 2010-04-15 16:29:20 +0200 (jeu., 15 avril 2010) $ By :
Author:
chatellier

Field Summary
protected  java.lang.String filename
           
protected  long position
           
protected  java.io.RandomAccessFile randomfile
           
 
Constructor Summary
ReverseFileReader(java.io.File file)
           
ReverseFileReader(java.lang.String filename)
           
 
Method Summary
 void close()
           
protected  void finalize()
           
 java.lang.String readLine()
          Read one line from the current position towards the beginning.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filename

protected java.lang.String filename

randomfile

protected java.io.RandomAccessFile randomfile

position

protected long position
Constructor Detail

ReverseFileReader

public ReverseFileReader(java.io.File file)
                  throws java.io.IOException
Throws:
java.io.IOException

ReverseFileReader

public ReverseFileReader(java.lang.String filename)
                  throws java.io.IOException
Throws:
java.io.IOException
Method Detail

readLine

public java.lang.String readLine()
                          throws java.io.IOException
Read one line from the current position towards the beginning.

Returns:
the next line of text from this file, or null if end of file is encountered before even one byte is read.
Throws:
java.io.IOException - if any pb while reading line

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable


Copyright © 2004-2010 CodeLutin. All Rights Reserved.