本文整理汇总了Java中org.geotools.data.shapefile.dbf.DbaseFileReader类的典型用法代码示例。如果您正苦于以下问题:Java DbaseFileReader类的具体用法?Java DbaseFileReader怎么用?Java DbaseFileReader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DbaseFileReader类属于org.geotools.data.shapefile.dbf包,在下文中一共展示了DbaseFileReader类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractDbfHeader
import org.geotools.data.shapefile.dbf.DbaseFileReader; //导入依赖的package包/类
/**
* Extract information from the DBF file header.
*
* @param reportables
* the class used to hold the features values found
* @throws IOException
* Signals that an I/O exception has occurred.
*/
private void extractDbfHeader(ShapefileFeatures features)
throws IOException
{
DbaseFileReader dbfReader = null;
try {
dbfReader = shapefileDS.openDbfReader();
DbaseFileHeader dbfHeader = dbfReader.getHeader();
DbfHeader dbfh = features.dbfHeader;
dbfh.recordCount = dbfHeader.getNumRecords();
dbfh.recordLength = dbfHeader.getRecordLength();
dbfh.fieldCount = dbfHeader.getNumFields();
for (int i = 0; i < dbfHeader.getNumFields(); i++) {
dbfh.fieldNames.add(dbfHeader.getFieldName(i));
}
}
finally {
if (dbfReader != null) {
dbfReader.close();
}
}
}