Public Member Functions | |
CacheEntry (Integer key, long startPos, long endPos) | |
CacheEntry (String hexadecimal) | |
String | toHexadecimal () |
Public Attributes | |
final int | key |
final long | start |
final long | end |
Static Public Attributes | |
static final int | ENTRY_LENGTH = 40 |
An entry of the cache. It contains the name of the file where the entry is stored together with the position of the entry.
Having the name of the file allows to open and close the file when needed. In a previous version there was a RandomAccessFile
instead of the name but it ended up with an error because the number of open file was exceeding the maximum allowed.
com.cosylab.logging.engine.cache.CacheEntry.CacheEntry | ( | Integer | key, | |
long | startPos, | |||
long | endPos | |||
) |
Constructor
key | The key of the file where the entry is stored | |
startPos | The starting position of the entry in the file | |
endPos | The ending position of the entry in the file |
References com.cosylab.logging.engine.cache.CacheEntry.end, and com.cosylab.logging.engine.cache.CacheEntry.start.
com.cosylab.logging.engine.cache.CacheEntry.CacheEntry | ( | String | hexadecimal | ) |
Constructor.
Build the entry by its hexadecimal representation
hexadecimal |
References com.cosylab.logging.engine.cache.CacheEntry.end, com.cosylab.logging.engine.cache.CacheEntry.key, and com.cosylab.logging.engine.cache.CacheEntry.start.
String com.cosylab.logging.engine.cache.CacheEntry.toHexadecimal | ( | ) |
Translate the content of the entry in an hexadecimal string composed of the key, the start and end.
The array returned by this method can be written on a file. Its length is constant for each possible entry so the fields are not separated.
References com.cosylab.logging.engine.cache.CacheEntry.end, com.cosylab.logging.engine.cache.CacheEntry.key, and com.cosylab.logging.engine.cache.CacheEntry.start.
The ending position of the entry in the file
Referenced by com.cosylab.logging.engine.cache.CacheEntry.CacheEntry(), and com.cosylab.logging.engine.cache.CacheEntry.toHexadecimal().
final int com.cosylab.logging.engine.cache.CacheEntry.ENTRY_LENGTH = 40 [static] |
The length of the bytes representing each entry.
This number is useful while caching the entries on a file.
40 is 8 for the integer and 2 time 16 for the longs.
The key of the file where the entry is stored
Referenced by com.cosylab.logging.engine.cache.CacheEntry.CacheEntry(), com.cosylab.logging.engine.cache.EngineCache.pop(), and com.cosylab.logging.engine.cache.CacheEntry.toHexadecimal().
The starting position of the entry in the file
Referenced by com.cosylab.logging.engine.cache.CacheEntry.CacheEntry(), and com.cosylab.logging.engine.cache.CacheEntry.toHexadecimal().