org.xBaseJ.fields
Class Field

java.lang.Object
  extended byorg.xBaseJ.fields.Field
All Implemented Interfaces:
Cloneable, Externalizable, Serializable
Direct Known Subclasses:
CharField, DateField, LogicalField, MemoField, NumField, PictureField

public abstract class Field
extends Object
implements Cloneable, Externalizable

See Also:
Serialized Form

Field Summary
 byte[] buffer
           
 java.nio.ByteBuffer bytebuffer
           
 boolean Deleted
           
 int Length
           
 long myoffset
           
 String Name
           
static String otherValidCharacters
           
 
Constructor Summary
Field()
          creates a Field object.
 
Method Summary
 Object clone()
           
 String get()
           
 byte[] getBytes()
          returns the original byte array as stored in the file.
 int getDecimalPositionCount()
           
 int getLength()
           
 String getName()
           
 char getType()
           
 void put(byte[] inValue)
          set field contents with binary data, no database updates until a DBF update or write is issued if inValue is too short buffer is filled with binary zeros.
 void put(String inValue)
          set field contents, no database updates until a DBF update or write is issued
 void read()
           
 void readExternal(ObjectInput in)
          used by externalize methods
 void setBuffer(java.nio.ByteBuffer inBuffer)
           
 void setBufferSpace()
           
 void setField(String iName, int iLength, java.nio.ByteBuffer inbuffer)
           
 void update()
           
 void write()
           
 void writeExternal(ObjectOutput out)
          used by externalize methods
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Name

public String Name

Length

public int Length

buffer

public byte[] buffer

Deleted

public boolean Deleted

bytebuffer

public java.nio.ByteBuffer bytebuffer

myoffset

public long myoffset

otherValidCharacters

public static String otherValidCharacters
Constructor Detail

Field

public Field()
creates a Field object. not useful for the abstract Field class

See Also:
CharField, DateField, LogicalField, MemoField, NumField
Method Detail

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
used by externalize methods

Specified by:
readExternal in interface Externalizable
Parameters:
in - ObjectInput stream
Throws:
IOException - - most likely class changed since written
ClassNotFoundException - - only when dummy constructro not found

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
used by externalize methods

Specified by:
writeExternal in interface Externalizable
Parameters:
out - ObjectOutput stream
Throws:
IOException - Java.io error

clone

public Object clone()
             throws CloneNotSupportedException
Throws:
CloneNotSupportedException

setField

public void setField(String iName,
                     int iLength,
                     java.nio.ByteBuffer inbuffer)
              throws xBaseJException
Throws:
xBaseJException

setBuffer

public void setBuffer(java.nio.ByteBuffer inBuffer)

setBufferSpace

public void setBufferSpace()

getName

public String getName()
Returns:
String contianing the field name

getLength

public int getLength()
Returns:
int - the field length

getType

public char getType()
             throws xBaseJException
Returns:
char field type
Throws:
xBaseJException - undefined field type

getDecimalPositionCount

public int getDecimalPositionCount()
Returns:
int - the number of decimal positions for numeric fields, zero returned otherwise

read

public void read()
          throws IOException,
                 xBaseJException
Throws:
IOException
xBaseJException

get

public String get()
Returns:
String field contents after any type of read.

getBytes

public byte[] getBytes()
returns the original byte array as stored in the file.

Returns:
byte[] - may return a null if not set

write

public void write()
           throws IOException,
                  xBaseJException
Throws:
IOException
xBaseJException

update

public void update()
            throws IOException,
                   xBaseJException
Throws:
IOException
xBaseJException

put

public void put(String inValue)
         throws xBaseJException
set field contents, no database updates until a DBF update or write is issued

Parameters:
inValue - value to set
Throws:
xBaseJException - value length too long

put

public void put(byte[] inValue)
         throws xBaseJException
set field contents with binary data, no database updates until a DBF update or write is issued if inValue is too short buffer is filled with binary zeros.

Parameters:
inValue - byte array
Throws:
xBaseJException - value length too long


Copyright 1997-2007 American Coders Ltd. All Rights Reserved.