public abstract class OffsetReader extends Object
OffsetReader
giving generic
algorithms to extract offsets from a LineReader
.Modifier and Type | Field and Description |
---|---|
protected long |
nbLines
number of lines managed by the reader
|
Constructor and Description |
---|
OffsetReader() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the reader
|
protected long |
createOffsets(LineReader lineReader) |
protected long |
createOffsets(LineReader lineReader,
LineReader parent) |
void |
deleteOffsetFile()
delete offset resources
|
long |
getNbLines() |
abstract long |
getOffset(long position)
Obtain an offset for a position
|
protected boolean |
isLogEntry(String line) |
protected abstract boolean |
needCreate() |
void |
open(LineReader reader)
Open the reader
|
protected String |
readLine(BufferedReader reader)
read a line from reader including terminaison caracters
|
protected abstract void |
storeOffset(long position,
long offset)
Save the offset of the line for a given position
|
void |
update(LineReader lineReader)
Update the reader
|
protected abstract void storeOffset(long position, long offset) throws IOException
position
- current line positionoffset
- current offset of lineIOException
- if any problem while storingprotected abstract boolean needCreate() throws IOException
true
if the reader need to create his internal
datas.IOException
- if any problme while creatingpublic abstract long getOffset(long position) throws IOException
position
- position of the lineIOException
- todopublic void open(LineReader reader) throws IOException
reader
- LineReader linked with this readerIOException
- if any problem while openingpublic void close() throws IOException
IOException
- if any problem while closingpublic long getNbLines()
public void update(LineReader lineReader) throws IOException
lineReader
- lineReader linked with this readerIOException
- if any problem while updatingprotected boolean isLogEntry(String line) throws IOException
IOException
protected String readLine(BufferedReader reader) throws IOException
reader
- reader to useIOException
- if any problem while readingprotected long createOffsets(LineReader lineReader) throws IOException
IOException
protected long createOffsets(LineReader lineReader, LineReader parent) throws IOException
IOException
public void deleteOffsetFile()
Copyright © 1999–2020 CodeLutin. All rights reserved.