|
||||||||||
| 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 java.io.File |
file
|
protected java.lang.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 java.io.RandomAccessFile |
reader
file reader |
| Constructor Summary | |
|---|---|
LineReader(java.io.File file,
OffsetReader offstReader)
|
|
LineReader(LineReader parent,
OffsetReader offstReader)
|
|
| Method Summary | |
|---|---|
void |
close()
Close the reader. |
protected void |
ensureOpen()
|
protected void |
finalize()
|
java.io.File |
getFile()
|
java.lang.String |
getId()
|
long |
getNbLines()
|
OffsetReader |
getOffsetReader()
|
LineReader |
getParent()
|
boolean |
isOpen()
|
boolean |
isUpToDate()
|
boolean |
match(java.lang.String line)
Matcher of line for this reader. |
void |
open()
method we must inovke before any access to lines |
java.lang.String |
readLine(long position)
Read a line from a given position. |
java.lang.String[] |
readLine(long position,
int length)
Read some line(s) from a given position. |
java.lang.String |
readLine2(long position)
Read a line from a given position. |
java.lang.String[] |
readLine2(long position,
int length)
Read some line(s) from a given position. |
void |
setId(java.lang.String id)
|
java.lang.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 java.io.File file
protected java.io.RandomAccessFile reader
protected long length
protected long lastModified
protected LineReader parent
protected OffsetReader offstReader
protected java.lang.String id
| Constructor Detail |
|---|
public LineReader(LineReader parent,
OffsetReader offstReader)
public LineReader(java.io.File file,
OffsetReader offstReader)
| Method Detail |
|---|
public void open()
throws java.io.IOException
java.io.IOException - if any probem while opening reader
public void close()
throws java.io.IOException
java.io.IOException - if any problem while closing reader
public java.lang.String readLine2(long position)
throws java.io.IOException
position - position of the line in the file
java.io.IOException - if any problem while reading
public java.lang.String[] readLine2(long position,
int length)
throws java.io.IOException
position - position of the line in the filelength - the number of lines we want
java.io.IOException - if any problem while reading
public java.lang.String readLine(long position)
throws java.io.IOException
position - position of the line in the file
java.io.IOException - if any problem while reading
public java.lang.String[] readLine(long position,
int length)
throws java.io.IOException
position - position of the line in the filelength - the number of lines we want
java.io.IOException - if any problem while reading
public void update()
throws java.io.IOException
java.io.IOException - if any problem while updatingpublic boolean match(java.lang.String line)
line - the line to be accepted by this line reader
true if the line must be used,false
otherwisepublic long getNbLines()
public java.io.File getFile()
public OffsetReader getOffsetReader()
public LineReader getParent()
public boolean isUpToDate()
true if file is up to date,false
otherwisepublic java.lang.String toString()
toString in class java.lang.Object
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwableprotected void ensureOpen()
public boolean isOpen()
public java.lang.String getId()
public void setId(java.lang.String id)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||