Parsing methods for DBF files

Source: Internet
Author: User
Tags instance method

Download the jar rack package for DBF first Http://pan.baidu.com/s/1jIqVIcA

InputStream FIS = null;
String sresult = "";
try {
Read the input stream of a file
FIS = new FileInputStream (path);
Initializes an Dbfreader instance based on the input stream to read the DBF file information
Dbfreader reader = new Dbfreader (FIS);
Call Dbfreader to get the number of fields in the path file for the instance method
int fieldscount = Reader.getfieldcount ();
Remove field information
for (int i = 0; i < Fieldscount; i++) {
Dbffield field = Reader.getfield (i);
System.out.println (Field.getname ());
}

Object[] rowvalues;
Strips are taken out of the path file.
while ((rowvalues = Reader.nextrecord ()) = null) {
for (int i = 0; i < rowvalues.length; i++) {
System.out.println (Rowvalues[i]);
}
}


} catch (Exception e) {
E.printstacktrace ();
} finally {
try {
Fis.close ();
} catch (Exception e) {
}
}

Parsing methods for DBF files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.