brf.j2me.dynaworks.db
Class StringField

java.lang.Object
  |
  +--brf.j2me.dynaworks.db.RecordField
        |
        +--brf.j2me.dynaworks.db.StringField

public class StringField
extends RecordField

Record field holding a character string of fixed length.

Version:
1.0a1
Author:
Bernd R. Fix
See Also:
RecordField

Field Summary
private  java.lang.String content
          character string as field data.
 
Fields inherited from class brf.j2me.dynaworks.db.RecordField
size
 
Constructor Summary
StringField()
          Construct a string field of variable length.
 
Method Summary
 boolean fromImage(byte[] m)
          Convert a byte array into string field data.
 int getExpectedSize(byte[] data, int pos)
          Get the expected length of the string.
 java.lang.String getValue()
          Get the string data.
 void setValue(java.lang.String str)
          Set the string data.
 byte[] toImage()
          Convert the string field data into a byte array.
 
Methods inherited from class brf.j2me.dynaworks.db.RecordField
getSize
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

content

private java.lang.String content
character string as field data.

Constructor Detail

StringField

public StringField()
Construct a string field of variable length.

Method Detail

getExpectedSize

public int getExpectedSize(byte[] data,
                           int pos)
Get the expected length of the string.

Overrides:
getExpectedSize in class RecordField
Parameters:
data - byte[] - byte representation of record data
pos - int - offset into record.
Returns:
int - expected length of string.

getValue

public java.lang.String getValue()
Get the string data.

Returns:
String - Character string.

setValue

public void setValue(java.lang.String str)
Set the string data.

Parameters:
str - String - new character string.

toImage

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

Overrides:
toImage in class RecordField
Returns:
byte[] - array containing the field data.

fromImage

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

Overrides:
fromImage in class RecordField
Parameters:
m - byte[] - array holding the data.
Returns:
boolean - conversion successful?