Public Member Functions | Public Attributes | Static Public Attributes

com.cosylab.logging.engine.cache.CacheEntry Class Reference

List of all members.

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

Detailed Description

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.

Author:
acaproni

Constructor & Destructor Documentation

com.cosylab.logging.engine.cache.CacheEntry.CacheEntry ( Integer  key,
long  startPos,
long  endPos 
)

Constructor

Parameters:
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

Parameters:
hexadecimal 
See also:
toHexadecimal()

References com.cosylab.logging.engine.cache.CacheEntry.end, com.cosylab.logging.engine.cache.CacheEntry.key, and com.cosylab.logging.engine.cache.CacheEntry.start.


Member Function Documentation

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.

Returns:
An hexadecimal string representing the content of this entry

References com.cosylab.logging.engine.cache.CacheEntry.end, com.cosylab.logging.engine.cache.CacheEntry.key, and com.cosylab.logging.engine.cache.CacheEntry.start.


Member Data Documentation

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.

See also:
toBytes()

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties