|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.ifremer.isisfish.logging.io.OffsetReader
fr.ifremer.isisfish.logging.io.FileOffsetReader
public class FileOffsetReader
A simple implementation of OffsetReader using a file for
dealing with offsets.
offsetFile, generated
by createOffsets(LineReader). or
createOffsets(LineReader , LineReader).
| Field Summary | |
|---|---|
protected static org.apache.commons.logging.Log |
log
|
protected File |
offsetFile
offset file to read |
protected RandomAccessFile |
offsetReader
offset file reader |
protected RandomAccessFile |
writer
writer used while creation or update |
| Fields inherited from class fr.ifremer.isisfish.logging.io.OffsetReader |
|---|
nbLines |
| Constructor Summary | |
|---|---|
FileOffsetReader(File file)
|
|
| Method Summary | |
|---|---|
void |
close()
Close the reader |
protected long |
createOffsets(LineReader lineReader)
|
protected long |
createOffsets(LineReader lineReader,
LineReader parent)
|
void |
deleteOffsetFile()
delete offset resources |
long |
getOffset(long position)
Obtain an offset for a position |
protected boolean |
needCreate()
|
void |
open(LineReader reader)
Open the reader |
protected void |
storeOffset(long position,
long offset)
Save the offset of the line for a given position |
String |
toString()
|
void |
update(LineReader lineReader)
Update the reader |
| Methods inherited from class fr.ifremer.isisfish.logging.io.OffsetReader |
|---|
createOffsetsForLog, getNbLines, isLogEntry, readLine |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.commons.logging.Log log
protected File offsetFile
protected RandomAccessFile offsetReader
protected RandomAccessFile writer
| Constructor Detail |
|---|
public FileOffsetReader(File file)
| Method Detail |
|---|
public long getOffset(long position)
throws IOException
OffsetReader
getOffset in class OffsetReaderposition - position of the line
IOException - todo
public void open(LineReader reader)
throws IOException
OffsetReader
open in class OffsetReaderreader - LineReader linked with this reader
IOException - if any problem while opening
public void close()
throws IOException
OffsetReader
close in class OffsetReaderIOException - if any problem while closing
public void update(LineReader lineReader)
throws IOException
OffsetReader
update in class OffsetReaderlineReader - lineReader linked with this reader
IOException - if any problem while updatingpublic void deleteOffsetFile()
OffsetReader
deleteOffsetFile in class OffsetReaderpublic String toString()
toString in class Object
protected void storeOffset(long position,
long offset)
throws IOException
OffsetReader
storeOffset in class OffsetReaderposition - current line positionoffset - current offset of line
IOException - if any problem while storing
protected boolean needCreate()
throws IOException
needCreate in class OffsetReadertrue if the reader need to create his internal
datas.
IOException - if any problme while creating
protected long createOffsets(LineReader lineReader)
throws IOException
createOffsets in class OffsetReaderIOException
protected long createOffsets(LineReader lineReader,
LineReader parent)
throws IOException
createOffsets in class OffsetReaderIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||