public class RecordMap
extends java.lang.Object
To work out the buffer and offset from which to read a record value, you can do something like this:
int ient = recMap.getEntryIndex(irec); Object value = ient >= 0 ? readBuffer(recMap.getBuf(ient), recMap.getOffset(ient,irec)) : NO_STORED_VALUE;
Modifier and Type | Method and Description |
---|---|
static RecordMap |
createRecordMap(VariableDescriptorRecord vdr,
RecordFactory recFact,
int recSize)
Returns a record map for a given variable.
|
Buf |
getBuf(int ient)
Returns the data buffer for a given entry.
|
int |
getEntryCount()
Returns the number of entries managed by this map.
|
int |
getEntryIndex(int irec)
Returns the index of the entry containing a given record.
|
long |
getFinalOffsetInEntry(int ient)
Returns the offset of the last record in a given entry.
|
long |
getOffset(int ient,
int irec)
Returns the byte offset for a record in a given entry.
|
public int getEntryCount()
public int getEntryIndex(int irec)
(-fr-2)
, where fr
is the index of the previous entry.
A value of -1 indicates that the requested record is
in a sparse region before the first stored record.
If non-negative, the result can be used with the
getBuf
and getOffset
methods.
irec
- record indexirec
, or a negative
value if no entry covers itpublic Buf getBuf(int ient)
ient
- entry indexgetEntryIndex(int)
public long getOffset(int ient, int irec)
ient
parameter must reference an actual entry
(it must be non-negative), and that entry must contain
the given record irec
,ient
- entry index for entry containing irec
irec
- record indexirec
can be foundgetEntryIndex(int)
public long getFinalOffsetInEntry(int ient)
ient
- non-negative entry indexpublic static RecordMap createRecordMap(VariableDescriptorRecord vdr, RecordFactory recFact, int recSize) throws java.io.IOException
vdr
- variable descriptor recordrecFact
- record factoryrecSize
- size in bytes of each variable value recordjava.io.IOException