|
||||||||||
| 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.MemoryOffsetReader
public class MemoryOffsetReader
This class is a Offset Reader using a memory cache.
All offsets are saved in memory.
| Field Summary | |
|---|---|
protected int |
capacity
capacity of cache |
protected static org.apache.commons.logging.Log |
log
|
protected java.util.Map<java.lang.Long,java.lang.Long> |
offsetCache
cache of offsets |
| Fields inherited from class fr.ifremer.isisfish.logging.io.OffsetReader |
|---|
nbLines |
| Constructor Summary | |
|---|---|
MemoryOffsetReader(int capacity)
|
|
| Method Summary | |
|---|---|
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 |
java.lang.String |
toString()
|
| Methods inherited from class fr.ifremer.isisfish.logging.io.OffsetReader |
|---|
createOffsets, createOffsets, createOffsetsForLog, deleteOffsetFile, getNbLines, isLogEntry, open, readLine, update |
| 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 java.util.Map<java.lang.Long,java.lang.Long> offsetCache
protected int capacity
| Constructor Detail |
|---|
public MemoryOffsetReader(int capacity)
| Method Detail |
|---|
public void close()
throws java.io.IOException
OffsetReader
close in class OffsetReaderjava.io.IOException - if any problem while closingpublic long getOffset(long position)
OffsetReader
getOffset in class OffsetReaderposition - position of the line
protected void storeOffset(long position,
long offset)
OffsetReader
storeOffset in class OffsetReaderposition - current line positionoffset - current offset of lineprotected boolean needCreate()
needCreate in class OffsetReadertrue if the reader need to create his internal
datas.public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||