|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.ifremer.isisfish.logging.io.LineReader
public class LineReader
A lineReader reads lines from a file using a RandomAccessFile.
OffsetReader to obtain
the offset of the first char of a line.
You can create a new LineReader from a previous one, the matchings lines of
the new LineReader will all match the parent one (subset LineReader).
| Field Summary | |
|---|---|
protected File |
file
|
protected String |
id
an identifier for the reader |
protected long |
lastModified
last modified time of the file after last synchronization |
protected long |
length
size of the file after last synchronization |
protected static org.apache.commons.logging.Log |
log
|
protected OffsetReader |
offstReader
offset reader used |
protected LineReader |
parent
parent LineReader |
protected RandomAccessFile |
reader
file reader |
| Constructor Summary | |
|---|---|
LineReader(File file,
OffsetReader offstReader)
|
|
LineReader(LineReader parent,
OffsetReader offstReader)
|
|
| Method Summary | |
|---|---|
void |
close()
Close the reader. |
protected void |
ensureOpen()
|
protected void |
finalize()
|
File |
getFile()
|
String |
getId()
|
long |
getNbLines()
|
OffsetReader |
getOffsetReader()
|
LineReader |
getParent()
|
boolean |
isOpen()
|
boolean |
isUpToDate()
|
boolean |
match(String line)
Matcher of line for this reader. |
void |
open()
method we must inovke before any access to lines |
String |
readLine(long position)
Read a line from a given position. |
String[] |
readLine(long position,
int length)
Read some line(s) from a given position. |
String |
readLine2(long position)
Read a line from a given position. |
String[] |
readLine2(long position,
int length)
Read some line(s) from a given position. |
void |
setId(String id)
|
String |
toString()
|
void |
update()
check if reader is up to date, and if not perform an update. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.commons.logging.Log log
protected File file
protected RandomAccessFile reader
protected long length
protected long lastModified
protected LineReader parent
protected OffsetReader offstReader
protected String id
| Constructor Detail |
|---|
public LineReader(LineReader parent,
OffsetReader offstReader)
public LineReader(File file,
OffsetReader offstReader)
| Method Detail |
|---|
public void open()
throws IOException
IOException - if any probem while opening reader
public void close()
throws IOException
IOException - if any problem while closing reader
public String readLine2(long position)
throws IOException
position - position of the line in the file
IOException - if any problem while reading
public String[] readLine2(long position,
int length)
throws IOException
position - position of the line in the filelength - the number of lines we want
IOException - if any problem while reading
public String readLine(long position)
throws IOException
position - position of the line in the file
IOException - if any problem while reading
public String[] readLine(long position,
int length)
throws IOException
position - position of the line in the filelength - the number of lines we want
IOException - if any problem while reading
public void update()
throws IOException
IOException - if any problem while updatingpublic boolean match(String line)
line - the line to be accepted by this line reader
true if the line must be used,false
otherwisepublic long getNbLines()
public File getFile()
public OffsetReader getOffsetReader()
public LineReader getParent()
public boolean isUpToDate()
true if file is up to date,false
otherwisepublic String toString()
toString in class Object
protected void finalize()
throws Throwable
finalize in class ObjectThrowableprotected void ensureOpen()
public boolean isOpen()
public String getId()
public void setId(String id)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||