Package io.github.zazalng
Class DBF
java.lang.Object
io.github.zazalng.DBF
Minimal DBF reader focused on reading and accessing DBF data.
This implementation aims to be conservative and extensible, focusing on core DBF file features like reading the header, field descriptors, and all data records as a snapshot. It also supports up to 60 charsets possible for text encoding.
Key Features:- Read header and field descriptors.
- Read all records as a snapshot at construction and on
reload().
- Memo fields (.dbt/.fpt/.dbt-like memo) are not parsed here (placeholder).
- Visual FoxPro-specific binary types, timestamps, and some Level 7 features are partially unsupported.
- Since:
- 1.0.0
- Version:
- 1.0.0
- Author:
- Zazalng
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new DBF reader instance and immediately attempts to load the file data.DBF(Path path, DBFEncoding encoding) Constructs a new DBF reader instance with Enforce with forcing Decode with DBFEncoding and immediately attempts to load the file data. -
Method Summary
Modifier and TypeMethodDescriptionGets a list of field descriptors (columns) as defined in the DBF header.Gets the parsed header information for the DBF file.Gets the list of all data records read from the DBF file.Gets the version/dialect of the DBF file format.voidreload()Clears the current data and reloads the DBF file from the disk.
-
Constructor Details
-
DBF
Constructs a new DBF reader instance with Enforce with forcing Decode with DBFEncoding and immediately attempts to load the file data.- Parameters:
path- The path to the DBF file. Must not be null.encoding- The character encoding to use for text fields. If null, defaults based on header info.- Throws:
IOException- If an I/O error occurs while reading the file.NullPointerException- If the provided path is null.
-
DBF
Constructs a new DBF reader instance and immediately attempts to load the file data.- Parameters:
path- The path to the DBF file. Must not be null.- Throws:
IOException- If an I/O error occurs while reading the file.NullPointerException- If the provided path is null.
-
-
Method Details
-
reload
Clears the current data and reloads the DBF file from the disk. This will re-read the header and all records, updating the internal state.- Throws:
IOException- If an I/O error occurs while reading the file.
-
getHeader
Gets the parsed header information for the DBF file.- Returns:
- The
DBFHeaderobject.
-
getFields
Gets a list of field descriptors (columns) as defined in the DBF header.- Returns:
- An unmodifiable
ListofDBFFieldobjects.
-
getRecords
Gets the list of all data records read from the DBF file. This is a snapshot taken during the lastload(DBFEncoding)orreload()call.- Returns:
- An unmodifiable
ListofDBFRowobjects.
-
getVersion
Gets the version/dialect of the DBF file format.- Returns:
- The
DBFVersionof the file.
-