使用java实现的dbf文件读写库,非常方便。
示例代码:
public static void main(String args[]) throws Exception { //DBFReader dbfreader = new DBFReader((new URL("http://www.svcon.com/us48st.dbf")).openStream()); //DBFReader dbfreader = new DBFReader("F:\\work\\book2.dbf"); DBFReader dbfreader = new DBFReader("./book2.dbf"); //DBFReader dbfreader = new DBFReader("E:\\hexiongshare\\test.dbf"); int i; for (i=0; i<dbfreader.getFieldCount(); i++) { System.out.print(dbfreader.getField(i).getName()+" "); } System.out.print("\n"); for(i = 0; dbfreader.hasNextRecord(); i++) { Object aobj[] = dbfreader.nextRecord(Charset.forName("GBK")); for (int j=0; j<aobj.length; j++) System.out.print(aobj[j]+" | "); System.out.print("\n"); } System.out.println("Total Count: " + i); }