uk.ac.bristol.star.cdf.record
Class RecordPlan

java.lang.Object
  extended by uk.ac.bristol.star.cdf.record.RecordPlan

public class RecordPlan
extends java.lang.Object

Records basic information about the position, extent and type of a CDF record.

Since:
18 Jun 2013

Constructor Summary
RecordPlan(long start, long recSize, int recType, Buf buf)
          Constructor.
 
Method Summary
 Pointer createContentPointer()
          Returns a pointer initially pointing at the first content byte of the record represented by this plan.
 Buf getBuf()
          Returns the buffer containing the record data.
 long getReadCount(Pointer ptr)
          Returns the number of bytes in this record read (or skipped) by the current state of a given pointer.
 long getRecordSize()
          Returns the size of the record in bytes.
 int getRecordType()
          Returns the type code identifying what kind of CDF record it is.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecordPlan

public RecordPlan(long start,
                  long recSize,
                  int recType,
                  Buf buf)
Constructor.

Parameters:
start - offset into buffer of record start
recSize - number of bytes comprising record
recType - integer record type field
buf - buffer containing record bytes
Method Detail

getRecordSize

public long getRecordSize()
Returns the size of the record in bytes.

Returns:
record size

getRecordType

public int getRecordType()
Returns the type code identifying what kind of CDF record it is.

Returns:
record type

getBuf

public Buf getBuf()
Returns the buffer containing the record data.

Returns:
buffer

createContentPointer

public Pointer createContentPointer()
Returns a pointer initially pointing at the first content byte of the record represented by this plan. This is the first item after the RecordSize and RecordType items that always appear first in a CDF record, and whose values are known by this object.

Returns:
pointer pointing at the start of the record-type-specific content

getReadCount

public long getReadCount(Pointer ptr)
Returns the number of bytes in this record read (or skipped) by the current state of a given pointer.

Parameters:
ptr - pointer
Returns:
number of bytes between record start and pointer value