org.freecompany.redline.header
Class AbstractHeader.AbstractEntry<T>

java.lang.Object
  extended by org.freecompany.redline.header.AbstractHeader.AbstractEntry<T>
All Implemented Interfaces:
AbstractHeader.Entry<T>
Enclosing class:
AbstractHeader

public abstract class AbstractHeader.AbstractEntry<T>
extends java.lang.Object
implements AbstractHeader.Entry<T>


Field Summary
protected  int count
           
protected  int offset
           
protected  int size
           
protected  int tag
           
protected  T values
           
 
Constructor Summary
AbstractHeader.AbstractEntry()
           
 
Method Summary
 int getOffset(int offset)
           
 int getTag()
           
abstract  int getType()
          Returns the data type of this entry.
 T getValues()
           
 void index(java.nio.ByteBuffer index, int position)
          Writes the index entry into the provided buffer at the current position.
abstract  void read(java.nio.ByteBuffer buffer)
          Reads this entries value from the provided buffer using the set count.
 boolean ready()
          Returns true if this entry is ready to write, indicated by the presence of a set of values.
 void setCount(int count)
           
 void setOffset(int offset)
           
 void setSize(int size)
           
 void setTag(AbstractHeader.Tag tag)
           
 void setTag(int tag)
           
 void setValues(T values)
           
abstract  int size()
          Returns the size this entry will need in the provided data buffer to write it's contents, corrected for any trailing zeros to fill to a boundary.
 java.lang.String toString()
           
abstract  void write(java.nio.ByteBuffer data)
          Writes this entries index to the index buffer and its values to the output channel provided.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

size

protected int size

tag

protected int tag

count

protected int count

offset

protected int offset

values

protected T values
Constructor Detail

AbstractHeader.AbstractEntry

public AbstractHeader.AbstractEntry()
Method Detail

setTag

public void setTag(AbstractHeader.Tag tag)

setTag

public void setTag(int tag)
Specified by:
setTag in interface AbstractHeader.Entry<T>

setSize

public void setSize(int size)
Specified by:
setSize in interface AbstractHeader.Entry<T>

setCount

public void setCount(int count)
Specified by:
setCount in interface AbstractHeader.Entry<T>

setOffset

public void setOffset(int offset)
Specified by:
setOffset in interface AbstractHeader.Entry<T>

setValues

public void setValues(T values)
Specified by:
setValues in interface AbstractHeader.Entry<T>

getValues

public T getValues()
Specified by:
getValues in interface AbstractHeader.Entry<T>

getTag

public int getTag()
Specified by:
getTag in interface AbstractHeader.Entry<T>

getOffset

public int getOffset(int offset)
Specified by:
getOffset in interface AbstractHeader.Entry<T>

ready

public boolean ready()
Returns true if this entry is ready to write, indicated by the presence of a set of values.

Specified by:
ready in interface AbstractHeader.Entry<T>

getType

public abstract int getType()
Returns the data type of this entry.

Specified by:
getType in interface AbstractHeader.Entry<T>

size

public abstract int size()
Returns the size this entry will need in the provided data buffer to write it's contents, corrected for any trailing zeros to fill to a boundary.

Specified by:
size in interface AbstractHeader.Entry<T>

read

public abstract void read(java.nio.ByteBuffer buffer)
Reads this entries value from the provided buffer using the set count.

Specified by:
read in interface AbstractHeader.Entry<T>

write

public abstract void write(java.nio.ByteBuffer data)
Writes this entries index to the index buffer and its values to the output channel provided.

Specified by:
write in interface AbstractHeader.Entry<T>

index

public void index(java.nio.ByteBuffer index,
                  int position)
Writes the index entry into the provided buffer at the current position.

Specified by:
index in interface AbstractHeader.Entry<T>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object