public class DBFReader extends DBFBase implements Closeable
DBFReader cannot write to a DBF file. For creating DBF files use DBFWriter.
Fetching records is possible only in the forward direction and cannot be re-wound. In such situations, a suggested approach is to reconstruct the object.
The nextRecord() method returns an array of Objects and the types of these Object are as follows:
| xBase Type | Java Type |
|---|---|
| C | String |
| N | java.math.BigDecimal |
| F | java.math.BigDecimal |
| L | Boolean |
| D | java.util.Date |
| Y | java.math.BigDecimal |
| I | Integer |
| T | java.util.Date |
| @ | java.util.Date |
| +/td> | Integer |
| V | String |
| O | Double |
| M | java.lang.String or byte[] |
| B | byte[] or java.lang.Double |
| G | byte[] |
| P | byte[] |
| Q | byte[] |
DEFAULT_CHARSET, END_OF_DATA| Constructor and Description |
|---|
DBFReader(InputStream in)
Intializes a DBFReader object.
|
DBFReader(InputStream in,
Boolean showDeletedRows)
Intializes a DBFReader object.
|
DBFReader(InputStream in,
Charset charset)
Initializes a DBFReader object.
|
DBFReader(InputStream in,
Charset charset,
boolean showDeletedRows)
Initializes a DBFReader object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
DBFField |
getField(int index)
Returns the asked Field.
|
int |
getFieldCount()
Returns the number of field in the DBF.
|
protected DBFHeader |
getHeader() |
Date |
getLastModificationDate()
Returns the last time the file was modified
|
int |
getRecordCount()
Returns the number of records in the DBF.
|
boolean |
isTrimRightSpaces()
Determine if character fields should be right trimmed (default true)
|
Object[] |
nextRecord()
Reads the returns the next row in the DBF stream.
|
void |
setMemoFile(File memoFile)
Sets the memo file (DBT or FPT) where memo fields will be readed.
|
void |
setTrimRightSpaces(boolean trimRightSpaces)
Determine if character fields should be right trimmed (default true)
|
String |
toString() |
getCharactersetName, getCharset, setCharactersetName, setCharsetpublic DBFReader(InputStream in)
in - the InputStream where the data is read from.public DBFReader(InputStream in, Boolean showDeletedRows)
in - the InputStream where the data is read from.showDeletedRows - can be used to identify records that have been deleted.public DBFReader(InputStream in, Charset charset)
in - the InputStream where the data is read from.charset - charset used to decode field names and field contents. If null, then is autedetected from dbf filepublic DBFReader(InputStream in, Charset charset, boolean showDeletedRows)
in - the InputStream where the data is read from.charset - charset used to decode field names and field contents. If null, then is autedetected from dbf fileshowDeletedRows - can be used to identify records that have been deleted.public int getRecordCount()
public Date getLastModificationDate()
public DBFField getField(int index)
index - Index of the field. Index of the first field is zero.public int getFieldCount()
public Object[] nextRecord()
protected DBFHeader getHeader()
public boolean isTrimRightSpaces()
public void setTrimRightSpaces(boolean trimRightSpaces)
trimRightSpaces - public void setMemoFile(File memoFile)
memoFile - public void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2017. All rights reserved.