我正在尝试读取FoxPo .dbf文件,但是对于行:
低于错误while((rowObjects = reader.nextRecord())!= null)
ERROR:
com.linuxense.javadbf.DBFException:无法解析Number:empty 串 在com.linuxense.javadbf.DBFReader.nextRecord(DBFReader.java:310) at datamigration.DataMigration.main(DataMigration.java:34)
我们将不胜感激。
谢谢,
下面是我的代码:
package datamigration;
import java.io.*;
import com.linuxense.javadbf.*;
public class DataMigration {
public static void main(String args[]) {
try {
InputStream inputStream = new FileInputStream("D:/projects/DataMigration/data/customer.dbf");
DBFReader reader = new DBFReader(inputStream);
reader.setCharactersetName("gbk");
int numberOfFields = reader.getFieldCount();
for (int i = 0; i < numberOfFields; i++) {
DBFField field = reader.getField(i);
System.out.println(field.getName());
}
Object[] rowObjects;
while ((rowObjects = reader.nextRecord()) != null) {
for (int i = 0; i < rowObjects.length; i++) {
System.out.println(rowObjects[i]);
}
}
inputStream.close();
} catch (DBFException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}