datarecord
Class DataRecord

java.lang.Object
  extended by datarecord.DataRecord

public class DataRecord
extends java.lang.Object

For simplicity, all DataSource and DataSink classes use a single representation for data records in their buffers.
This is it.
A DataRecord is a byte[] plus two scalars: the total number of bytes actually stored in that array, plus the current offset (i.e., the offset to the first byte not already handed out, if a DataSource, or the first not yet written, if a DataSink. Note that the instance variables are all public. This makes it easier to call various Java API methods that read/write things like files and network connections. (Not to mention it avoids having to write a slew of trivial getter/setter functions.)

Version:
$Id: DataRecord.java,v 1.4 2010/01/05 07:59:07 zahorjan Exp $

Field Summary
 int capacity
          The size of the byte[] called data.
 byte[] data
          The data
 int length
          The number of unconsumed bytes of user data remaining in the buffer.
(package private)  java.lang.Integer mapKey
          An instance variable of what would normally be a local variable.
 int offset
          An offset into the record.
 
Constructor Summary
DataRecord(int size)
          Create the record and initialize to empty.
 
Method Summary
(package private)  void reInit()
          A method to initialize the portions of the DataRecord that may have changed if it has previously been used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

public byte[] data
The data


capacity

public int capacity
The size of the byte[] called data.


length

public int length
The number of unconsumed bytes of user data remaining in the buffer.


offset

public int offset
An offset into the record. For read(), the next byte to read. For write()... not used for write().


mapKey

java.lang.Integer mapKey
An instance variable of what would normally be a local variable. Done for the use of DataRecordManager, to achieve blazing speed...

Constructor Detail

DataRecord

DataRecord(int size)
Create the record and initialize to empty. Package scope. (Should be called only by DataRecordManager object.)

Method Detail

reInit

void reInit()
A method to initialize the portions of the DataRecord that may have changed if it has previously been used.