|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnl.knaw.dans.common.dbflib.Database
public class Database
Represents an xBase database. An xBase database is a directory containing table files (.DBF
files) and supporting files like memo (.DBT) or index (.NDX) files. This class allows you to work
with the database without having to open the lower level files directly. However, it is still
possible to open individual tables directly through the Table class.
| Constructor Summary | |
|---|---|
Database(File databaseDirectory,
Version version)
Creates a new Database object. |
|
Database(File databaseDirectory,
Version version,
String charsetName)
Creates a new Database object. |
|
| Method Summary | |
|---|---|
Table |
addTable(String name,
List<Field> fields)
Adds a new Table object to the set of Tables maintained by this
Database object and returns it. |
String |
getCharsetName()
Returns the name of the character set to use when reading from and writing to database files. |
Table |
getTable(String name)
Returns the Table object with the specified name or null if it has not
been added yet. |
Set<String> |
getTableNames()
Returns an unmodifiable Set of table names. |
void |
removeTable(String name)
Removes a Table object from the list of Table objects maintained by this
Database object. |
void |
removeTable(Table table)
Removes a Table object from the list of Table objects maintained by this
Database object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Database(File databaseDirectory,
Version version)
IllegalArgumentException.
All tables that exist in the database directory are added as Table objects and can
be retrieved with getTable(String).
The parameter version does not trigger any validation on an existing database but
is merely used to specify the version of newly added tables. It is therefore the
responsibility of the caller to ensure that the correct version is specified.
databaseDirectory - a java.io.File object pointing to the directory containing
the databaseversion - the version of xBase to use for new tables
public Database(File databaseDirectory,
Version version,
String charsetName)
IllegalArgumentException.
All tables that exist in the database directory are added as Table objects and can
be retrieved with getTable(String).
The parameter version does not trigger any validation on an existing database but
is merely used to specify the version of newly added tables. It is therefore the
responsibility of the caller to ensure that the correct version is specified.
databaseDirectory - a java.io.File object pointing to the directory containing
the databaseversion - the version of xBase to use for new tablescharsetName - the name of the character set to use, if null will be set to
the platform's default charset.| Method Detail |
|---|
public Set<String> getTableNames()
Set of table names.
Set of Table names.public Table getTable(String name)
Table object with the specified name or null if it has not
been added yet.
name - the name of the table, including extension
Table object
public Table addTable(String name,
List<Field> fields)
throws InvalidFieldTypeException,
InvalidFieldLengthException
Table object to the set of Tables maintained by this
Database object and returns it. If a Table object with
name already exists, it is returned.
Note that the actual table file (the .DBF file) may or may not exists. To create
a new table on disk, see Table.open(IfNonExistent).
name - the name of the table
Table object
InvalidFieldTypeException
InvalidFieldLengthExceptionpublic void removeTable(String name)
Table object from the list of Table objects maintained by this
Database object.
Note that the actual table file (the .DBF file) is not deleted by removing the
table object. To delete a file on disk, see Table.delete().
name - the name of the table to removepublic void removeTable(Table table)
Table object from the list of Table objects maintained by this
Database object.
Note that the actual table file (the .DBF file) is not deleted by removing the
table object. To delete a file on disk, see Table.delete().
table - the table to removepublic String getCharsetName()
Table's constructor.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||