brf.j2me.dynaworks.db
Class RecordField

java.lang.Object
  |
  +--brf.j2me.dynaworks.db.RecordField
Direct Known Subclasses:
BytesField, IntegerField, ShortField, StringField

public abstract class RecordField
extends java.lang.Object

Defines the base class of a record field.

Version:
1.0a1
Author:
Bernd R. Fix
See Also:
Record, StringField, IntegerField, BytesField, ShortField

Field Summary
protected  int size
          'byte' length of the field data.
 
Constructor Summary
RecordField()
           
 
Method Summary
 boolean fromImage(byte[] m)
          Convert a byte array into field data.
 int getExpectedSize(byte[] data, int pos)
          returns the expected length of a field starting at position 'pos' in the byte array 'data'.
 int getSize()
          Return the size of a record field.
 byte[] toImage()
          Convert the field data into a byte array.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

size

protected int size
'byte' length of the field data.

Constructor Detail

RecordField

public RecordField()
Method Detail

getSize

public int getSize()
Return the size of a record field.

Returns:
int - byte length of the field data.

getExpectedSize

public int getExpectedSize(byte[] data,
                           int pos)
returns the expected length of a field starting at position 'pos' in the byte array 'data'.

Parameters:
data - byte[] - byte representation of record.
pos - int - offset into array
Returns:
int - expected length of field

toImage

public byte[] toImage()
Convert the field data into a byte array.

Returns:
byte[] - byte array containing the field data.

fromImage

public boolean fromImage(byte[] m)
Convert a byte array into field data.

Parameters:
m - byte[] - array holding the data.
Returns:
boolean - conversion successful?