public class MemoryOffsetReader extends OffsetReader
Modifier and Type | Field and Description |
---|---|
protected int |
capacity
capacity of cache
|
protected static org.apache.commons.logging.Log |
log |
protected Map<Long,Long> |
offsetCache
cache of offsets
|
nbLines
Constructor and Description |
---|
MemoryOffsetReader(int capacity) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the reader
|
long |
getOffset(long position)
Obtain an offset for a position
|
protected boolean |
needCreate() |
protected void |
storeOffset(long position,
long offset)
Save the offset of the line for a given position
|
String |
toString() |
createOffsets, createOffsets, deleteOffsetFile, getNbLines, isLogEntry, open, readLine, update
protected static final org.apache.commons.logging.Log log
protected int capacity
public void close() throws IOException
OffsetReader
close
in class OffsetReader
IOException
- if any problem while closingpublic long getOffset(long position)
OffsetReader
getOffset
in class OffsetReader
position
- position of the lineprotected void storeOffset(long position, long offset)
OffsetReader
storeOffset
in class OffsetReader
position
- current line positionoffset
- current offset of lineprotected boolean needCreate()
needCreate
in class OffsetReader
true
if the reader need to create his internal
datas.Copyright © 1999–2020 CodeLutin. All rights reserved.