|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xBaseJ.DBF
Field Summary | |
java.nio.ByteBuffer |
buffer
|
java.nio.channels.FileChannel |
channel
|
static byte |
DBASEIII
|
static byte |
DBASEIII_WITH_MEMO
|
static byte |
DBASEIV
|
static byte |
DBASEIV_WITH_MEMO
|
static byte |
DELETED
|
static String |
encodedType
|
RandomAccessFile |
file
|
java.nio.channels.FileLock |
filelock
|
long |
fileLockWait
|
static byte |
FOXPRO_WITH_MEMO
|
MDXFile |
MDXfile
|
static byte |
NOTDELETED
|
static char |
READ_ONLY
|
boolean |
readonly
|
java.nio.channels.FileLock |
recordlock
|
boolean |
useSharedLocks
|
static String |
xBaseJVersion
|
Constructor Summary | |
DBF(String DBFname)
creates an DBF object and opens existing database file in read/write mode. |
|
DBF(String DBFname,
boolean destroy)
creates a new DBF file or replaces an existing database file, w/o format assumes dbaseiii file format. |
|
DBF(String DBFname,
boolean destroy,
String inEncodeType)
creates a new DBF file or replaces an existing database file, w/o format assumes dbaseiii file format. |
|
DBF(String DBFname,
char readOnly)
creates an DBF object and opens existing database file in readonly mode. |
|
DBF(String DBFname,
char readOnly,
String inEncodeType)
creates an DBF object and opens existing database file in readonly mode. |
|
DBF(String DBFname,
int format,
boolean destroy)
creates a new DBF file or replaces an existing database file. |
|
DBF(String DBFname,
int format,
boolean destroy,
String inEncodeType)
creates a new DBF file or replaces an existing database file. |
|
DBF(String DBFname,
String inEncodeType)
creates an DBF object and opens existing database file in read/write mode. |
Method Summary | |
void |
addField(Field aField)
adds a new Field to a database |
void |
addField(Field[] aField)
adds an array of new Fields to a database |
void |
changeField(Field oldField,
Field newField)
changes a Field in a database NOT FULLY IMPLEMENTED |
void |
close()
closes the database. |
Index |
createIndex(String filename,
String index,
boolean unique)
creates a new Index as a NDX file, assumes NDX file does not exist. |
Index |
createIndex(String filename,
String index,
boolean destroy,
boolean unique)
creates a new Index as a NDX file. |
Index |
createTag(String tagname,
String tagIndex,
boolean unique)
creates a tag in the MDX file. |
void |
delete()
marks the current records as deleted. |
boolean |
deleted()
returns true if record is marked for deletion |
void |
dropField(Field aField)
removes a Field from a database NOT FULLY IMPLEMENTED |
void |
finalize()
|
boolean |
find(String keyString)
used to find a record with an equal or greater string value. |
boolean |
find(String keyString,
boolean lock)
used to find a record with an equal or greater string value. |
boolean |
find(String keyString,
int recno)
used to find a record with an equal and at the particular record. |
boolean |
find(String keyString,
int recno,
boolean lock)
used to find a record with an equal and at the particular record. |
boolean |
findExact(String keyString)
used to find a record with an equal string value. |
boolean |
findExact(String keyString,
boolean lock)
used to find a record with an equal string value. |
void |
findNext()
used to get the next record in the index list. |
void |
findNext(boolean lock)
used to get the next record in the index list. |
void |
findPrev()
used to get the previous record in the index list. |
void |
findPrev(boolean lock)
used to get the previous record in the index list. |
int |
getCurrentRecordNumber()
returns the current record number |
static String |
getEncodingType()
gets the character encoding string value. |
Field |
getField(int i)
returns a Field object by its relative position. |
Field |
getField(String name)
returns a Field object by its name in the database. |
int |
getFieldCount()
returns the number of fields in a database |
Index |
getIndex(int indexPosition)
gets an Index object associated with the database. |
int |
getIndexCount()
returns the number of known index files and tags |
String |
getName()
returns the full path name of the database |
int |
getRecordCount()
returns the number of records in a database |
int |
getVersion()
returns the dbase version field. |
void |
getXML(PrintWriter pw)
generates an xml string representation using xbase.dtd |
File |
getXML(String inFileName)
generates an xml string representation using xbase.dtd |
void |
gotoRecord(int recno)
used to read a record at a particular place in the database. |
void |
gotoRecord(int recno,
boolean lock)
used to read a record at a particular place in the database. |
void |
lock()
locks the entire database will try 5 times within the fileLockTimeOut specified in org.xBaseJ.property fileLockTimeOut, default 5000 milliseconds (5 seconds) |
void |
lockRecord()
locks the current record, exclusively will try 5 times within the fileLockTimeOut specified in org.xBaseJ.property fileLockTimeOut, default 5000 milliseconds (5 seconds) |
void |
lockRecord(int recno)
locks a particular record, exclusively will try 5 times within the fileLockTimeOut specified in org.xBaseJ.property fileLockTimeOut, default 5000 milliseconds (5 seconds) |
void |
pack()
packs a DBF by removing deleted records and memo fields. |
void |
read()
used to read the next record, after the current record pointer, in the database. |
void |
read(boolean lock)
used to read the next record, after the current record pointer, in the database. |
void |
readPrev()
used to read the previous record, before the current record pointer, in the database. |
void |
readPrev(boolean lock)
used to read the previous record, before the current record pointer, in the database. |
void |
renameTo(String newname)
|
static void |
setEncodingType(String inType)
sets the character encoding variable. |
void |
setFileLockWait(long inLongWait)
sets the filelockwait timeout value in milliseconds defaults to 5000 milliseconds if negative value will not be set |
void |
setVersion(int b)
|
void |
startBottom()
used to position record pointer at the last record or index in the database. |
void |
startTop()
used to position record pointer at the first record or index in the database. |
void |
undelete()
marks the current records as not deleted. |
void |
unlock()
unlocks the entire database |
void |
unlockRecord()
unlocks the current locked recorfd |
void |
update_dbhead()
|
void |
update()
updates the record at the current position. |
void |
update(boolean lock)
updates the record at the current position. |
Index |
useIndex(Index ndx)
used to indicate the primary Index |
Index |
useIndex(String filename)
opens an Index file associated with the database. |
Index |
useIndex(String filename,
String ID)
opens an Index file associated with the database |
Index |
useIndexByID(String ID)
used to indicate the primary Index. |
Index |
useTag(String tagname)
associates all Index operations with an existing tag. |
Index |
useTag(String tagname,
String ID)
associates all Index operations with an existing tag. |
static String |
version()
|
void |
write()
used to write a new record in the database. |
void |
write(boolean lock)
used to write a new record in the database. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public RandomAccessFile file
public MDXFile MDXfile
public static final byte DBASEIII
public static final byte DBASEIV
public static final byte DBASEIII_WITH_MEMO
public static final byte DBASEIV_WITH_MEMO
public static final byte FOXPRO_WITH_MEMO
public static final byte NOTDELETED
public static final byte DELETED
public static final char READ_ONLY
public boolean readonly
public static final String xBaseJVersion
public static String encodedType
public java.nio.channels.FileChannel channel
public java.nio.channels.FileLock filelock
public java.nio.channels.FileLock recordlock
public long fileLockWait
public java.nio.ByteBuffer buffer
public boolean useSharedLocks
Constructor Detail |
public DBF(String DBFname, boolean destroy) throws xBaseJException, IOException, SecurityException
DBFname
- a new or existing database file, can be full or partial pathnamedestroy
- delete existing dbf.
xBaseJException
- File does exist and told not to destroy it.
xBaseJException
- Told to destroy but operating system can not destroy
IOException
- Java error caused by called methods
SecurityException
- Java error caused by called methods, most likely trying to create on a remote systempublic DBF(String DBFname, int format, boolean destroy) throws xBaseJException, IOException, SecurityException
DBFname
- a new or existing database file, can be full or partial pathnameformat
- use class constants DBASEIII or DBASEIVdestroy
- permission to destroy an existing database file
xBaseJException
- File does exist and told not to destroy it.
xBaseJException
- Told to destroy but operating system can not destroy
IOException
- Java error caused by called methods
SecurityException
- Java error caused by called methods, most likely trying to create on a remote systempublic DBF(String DBFname, char readOnly) throws xBaseJException, IOException
DBFname
- an existing database file, can be full or partial pathnamereadOnly
- see DBF.READ_ONLY
xBaseJException
- Can not find database
xBaseJException
- database not dbaseIII format
IOException
- Java error caused by called methodspublic DBF(String DBFname) throws xBaseJException, IOException
DBFname
- an existing database file, can be full or partial pathname
xBaseJException
- Can not find database
xBaseJException
- database not dbaseIII format
IOException
- Java error caused by called methodspublic DBF(String DBFname, boolean destroy, String inEncodeType) throws xBaseJException, IOException, SecurityException
DBFname
- a new or existing database file, can be full or partial pathnamedestroy
- delete existing dbf.
xBaseJException
- File does exist and told not to destroy it.
xBaseJException
- Told to destroy but operating system can not destroy
IOException
- Java error caused by called methods
SecurityException
- Java error caused by called methods, most likely trying to create on a remote systempublic DBF(String DBFname, int format, boolean destroy, String inEncodeType) throws xBaseJException, IOException, SecurityException
DBFname
- a new or existing database file, can be full or partial pathnameformat
- use class constants DBASEIII or DBASEIVdestroy
- permission to destroy an existing database fileinEncodeType
- file encoding value
xBaseJException
- File does exist and told not to destroy it.
xBaseJException
- Told to destroy but operating system can not destroy
IOException
- Java error caused by called methods
SecurityException
- Java error caused by called methods, most likely trying to create on a remote systempublic DBF(String DBFname, char readOnly, String inEncodeType) throws xBaseJException, IOException
DBFname
- an existing database file, can be full or partial pathnamereadOnly
- see DBF.READ_ONLYinEncodeType
- file encoding value
xBaseJException
- Can not find database
xBaseJException
- database not dbaseIII format
IOException
- Java error caused by called methodspublic DBF(String DBFname, String inEncodeType) throws xBaseJException, IOException
DBFname
- an existing database file, can be full or partial pathnameinEncodeType
- file encoding value
xBaseJException
- Can not find database
xBaseJException
- database not dbaseIII format
IOException
- Java error caused by called methodsMethod Detail |
public static final String version()
public void finalize() throws Throwable
Throwable
public void addField(Field aField) throws xBaseJException, IOException
aField
- a predefined Field object
xBaseJException
- org.xBaseJ error caused by called methods
IOException
- Java error caused by called methodsField
public void addField(Field[] aField) throws xBaseJException, IOException
aField
- an array of predefined Field object
xBaseJException
- passed an empty array or other error
IOException
- Java error caused by called methodsField
public void renameTo(String newname) throws IOException
IOException
public void setFileLockWait(long inLongWait)
inLongWait
- long millisecondspublic void lock() throws IOException, xBaseJException
IOException
- - related to java.nio.channels and filelocks
xBaseJException
- - file lock wait timed out,public void lockRecord() throws IOException, xBaseJException
IOException
- - related to java.nio.channels and filelocks
xBaseJException
- - file lock wait timed out,public void lockRecord(int recno) throws IOException, xBaseJException
recno
- record # to be locked
IOException
- - related to java.nio.channels and filelocks
xBaseJException
- - file lock wait timed out,public void unlock() throws IOException
IOException
- - related to java.nio.channels and filelockspublic void unlockRecord() throws IOException
IOException
- - related to java.nio.channels and filelockspublic void dropField(Field aField) throws xBaseJException, IOException
aField
- a field in the database
xBaseJException
- Field is not part of the database
IOException
- Java error caused by called methodsField
public void changeField(Field oldField, Field newField) throws xBaseJException, IOException
oldField
- a Field objectnewField
- a Field object
xBaseJException
- org.xBaseJ error caused by called methods
IOException
- Java error caused by called methodsField
public int getFieldCount()
public int getRecordCount()
xBaseJException
IOException
public int getCurrentRecordNumber()
public int getIndexCount()
public Index getIndex(int indexPosition) throws xBaseJException
indexPosition
-
xBaseJException
- index value incorrectpublic Index useIndex(String filename) throws xBaseJException, IOException
filename
- an existing ndx file(can be full or partial pathname) or mdx tag
xBaseJException
- org.xBaseJ Fields defined in index do not match fields in database
IOException
- Java error caused by called methodspublic Index useIndex(String filename, String ID) throws xBaseJException, IOException
filename
- an existing Index file, can be full or partial pathnameID
- a unique id to define Index at run-time.
xBaseJException
- org.xBaseJ Fields defined in Index do not match Fields in database
IOException
- Java error caused by called methodspublic Index useIndex(Index ndx) throws xBaseJException, IOException
ndx
- an Index object
xBaseJException
- org.xBaseJ Index not opened or not part of the database
IOException
- Java error caused by called methodspublic Index useIndexByID(String ID) throws xBaseJException
ID
- String index name
xBaseJException
- org.xBaseJ Index not opened or not part of the databaseuseIndex(String,String)
public Index useTag(String tagname) throws xBaseJException
tagname
- an existing tag name in the production MDX file
xBaseJException
- no MDX file
tagname not foundpublic Index useTag(String tagname, String ID) throws xBaseJException, IOException
tagname
- an existing tag name in the production MDX fileID
- a unique id to define Index at run-time.
xBaseJException
- no MDX file
tagname not found
IOException
- Java error caused by called methodspublic Index createIndex(String filename, String index, boolean unique) throws xBaseJException, IOException
filename
- a new Index file nameindex
- string identifying Fields used in Indexunique
- boolean to indicate if the key is always unique
xBaseJException
- NDX file already exists
IOException
- Java error caused by called methodspublic Index createIndex(String filename, String index, boolean destroy, boolean unique) throws xBaseJException, IOException
filename
- a new Index file nameindex
- string identifying Fields used in Indexdestroy
- permission to destory NDX if file existsunique
- boolean to indicate if the key is always unique
xBaseJException
- NDX file already exists
IOException
- Java error caused by called methodspublic Index createTag(String tagname, String tagIndex, boolean unique) throws xBaseJException, IOException
tagname
- a non-existing tag name in the production MDX filetagIndex
- string identifying Fields used in Indexunique
- boolean to indicate if the key is always unique
xBaseJException
- no MDX file
tagname already exists
IOException
- Java error caused by called methodspublic boolean find(String keyString, boolean lock) throws xBaseJException, IOException
keyString
- a search stringlock
- boolean lock record indicator
xBaseJException
- org.xBaseJ no Indexs opened with database
IOException
- Java error caused by called methodspublic boolean find(String keyString) throws xBaseJException, IOException
keyString
- a search string
xBaseJException
- org.xBaseJ no Indexs opened with database
IOException
- Java error caused by called methodspublic boolean find(String keyString, int recno, boolean lock) throws xBaseJException, IOException
keyString
- a search stringrecno
- - int record numberlock
- - boolean lock record indicator
xBaseJException
- org.xBaseJ Index not opened or not part of the database
IOException
- Java error caused by called methodspublic boolean find(String keyString, int recno) throws xBaseJException, IOException
keyString
- a search string
xBaseJException
- org.xBaseJ Index not opened or not part of the database
IOException
- Java error caused by called methodspublic boolean findExact(String keyString, boolean lock) throws xBaseJException, IOException
keyString
- a search stringlock
- - boolean lock record indiator
xBaseJException
- org.xBaseJ no Indexs opened with database
IOException
- Java error caused by called methodspublic boolean findExact(String keyString) throws xBaseJException, IOException
keyString
- a search string
xBaseJException
- org.xBaseJ no Indexs opened with database
IOException
- Java error caused by called methodspublic void findNext(boolean lock) throws xBaseJException, IOException
lock
- - boolean lock record indicator
xBaseJException
- org.xBaseJ Index not opened or not part of the database
eof - end of file
IOException
- Java error caused by called methodspublic void findNext() throws xBaseJException, IOException
xBaseJException
- org.xBaseJ Index not opened or not part of the database
eof - end of file
IOException
- Java error caused by called methodspublic void findPrev(boolean lock) throws xBaseJException, IOException
lock
- boolean lock record indicator
xBaseJException
- org.xBaseJ Index not opened or not part of the database
tof - top of file
IOException
- Java error caused by called methodspublic void findPrev() throws xBaseJException, IOException
xBaseJException
- org.xBaseJ Index not opened or not part of the database
tof - top of file
IOException
- Java error caused by called methodspublic void read(boolean lock) throws xBaseJException, IOException
lock
- - boolean lock record indicator
xBaseJException
- usually the end of file condition
IOException
- Java error caused by called methodspublic void read() throws xBaseJException, IOException
xBaseJException
- usually the end of file condition
IOException
- Java error caused by called methodspublic void readPrev(boolean lock) throws xBaseJException, IOException
lock
- - boolean lock record indicator
xBaseJException
- usually the top of file condition
IOException
- Java error caused by called methodspublic void readPrev() throws xBaseJException, IOException
xBaseJException
- usually the top of file condition
IOException
- Java error caused by called methodspublic void gotoRecord(int recno, boolean lock) throws xBaseJException, IOException
recno
- the relative position of the record to readlock
- - boolean lock record indicator
xBaseJException
- passed an negative number, 0 or value greater than the number of records in database
IOException
- Java error caused by called methodspublic void gotoRecord(int recno) throws xBaseJException, IOException
recno
- the relative position of the record to read
xBaseJException
- passed an negative number, 0 or value greater than the number of records in database
IOException
- Java error caused by called methodspublic void startTop() throws xBaseJException, IOException
xBaseJException
- most likely no records in database
IOException
- Java error caused by called methodspublic void startBottom() throws xBaseJException, IOException
xBaseJException
- most likely no records in database
IOException
- Java error caused by called methodspublic void write(boolean lock) throws xBaseJException, IOException
lock
- - boolean lock indicator - locks the entire file
during the write process and then unlocks the file.
xBaseJException
- any one of several errors
IOException
- Java error caused by called methodspublic void write() throws xBaseJException, IOException
xBaseJException
- any one of several errors
IOException
- Java error caused by called methodspublic void update(boolean lock) throws xBaseJException, IOException
lock
- - boolean lock indicator - locks the entire file
during the write process and then unlocks the file.
Also record lock will be released, regardless of parameter value
xBaseJException
- any one of several errors
IOException
- Java error caused by called methodspublic void update() throws xBaseJException, IOException
xBaseJException
- any one of several errors
IOException
- Java error caused by called methodspublic void delete() throws IOException, xBaseJException
xBaseJException
- usually occurs when no record has been read
IOException
- Java error caused by called methodspublic void undelete() throws IOException, xBaseJException
xBaseJException
- usually occurs when no record has been read.
IOException
- Java error caused by called methodspublic void close() throws IOException
IOException
- Java error caused by called methodspublic Field getField(int i) throws ArrayIndexOutOfBoundsException, xBaseJException
i
- Field number
xBaseJException
- usually occurs when Field number is less than 1 or greater than the number of fields
ArrayIndexOutOfBoundsException
public Field getField(String name) throws xBaseJException, ArrayIndexOutOfBoundsException
name
- Field name
xBaseJException
- Field name is not correct
ArrayIndexOutOfBoundsException
public String getName()
public boolean deleted()
public void update_dbhead() throws IOException
IOException
public void setVersion(int b)
public void pack() throws xBaseJException, IOException, SecurityException, CloneNotSupportedException
xBaseJException
- File does exist and told not to destroy it.
xBaseJException
- Told to destroy but operating system can not destroy
IOException
- Java error caused by called methods
CloneNotSupportedException
- Java error caused by called methods
SecurityException
public int getVersion()
public static void setEncodingType(String inType)
inType
- encoding type, default is "8859_1" could use "CP850" otherspublic static String getEncodingType()
public File getXML(String inFileName) throws IOException, xBaseJException
inFileName
- - String
IOException
xBaseJException
public void getXML(PrintWriter pw) throws IOException, xBaseJException
pw
- - PrinterWriter
IOException
xBaseJException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |