- 导入依赖
<dependency>
<groupId>com.github.albfernandez</groupId>
<artifactId>javadbf</artifactId>
<version>1.9.2</version>
</dependency>
- 读取数据
InputStream inputStream = new FileInputStream(filepath);
Charset charset = Charset.forName("GB2312");
DBFReader dbfReader = new DBFReader(inputStream,charset);
int fieldsCount = dbfReader.getFieldCount();
System.out.println(fieldsCount);
for (int i = 0; i < fieldsCount; i++) {
DBFField field = dbfReader.getField(i);
System.out.printf(field.getName()+" ");
}
Object[] rowValues;
while ((rowValues = dbfReader.nextRecord()) != null) {
place = (String) rowValues[4];
System.out.println(palce);
}