Package ucar.nc2.ui.gis.shapefile
Class DbaseFile
- java.lang.Object
-
- ucar.nc2.ui.gis.shapefile.DbaseFile
-
public class DbaseFile extends Object
Class to read a dbase file in its entirety.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean[]getBooleansByName(String Name)Extract the boolean array of data for a field by Name.double[]getDoublesByName(String Name)Extract the double array of data for a field by Name.DbaseDatagetField(int index)Extract the data for a field by field index number.DbaseDatagetField(String Name)Extract the data for a given field by name.StringgetFieldName(int i)Get the name of a field by column number.String[]getFieldNames()Get a list of all the field names in the dbase fileintgetNumFields()Get the number of fields in the file.intgetNumRecords()String[]getStringsByName(String Name)Extract the string array of data for a field by Name.booleanisLoaded()
-
-
-
Constructor Detail
-
DbaseFile
public DbaseFile(URL url) throws IOException
- Parameters:
url- URL to the *.dbf file- Throws:
IOException
-
DbaseFile
public DbaseFile(String spec) throws IOException
- Parameters:
spec- Location of the *.dbf file, as either a URL or filename- Throws:
IOException
-
DbaseFile
public DbaseFile(File file)
- Parameters:
file- A file object of the *.dbf file.
-
DbaseFile
public DbaseFile(InputStream s)
-
-
Method Detail
-
getField
public DbaseData getField(int index)
Extract the data for a field by field index number.- Parameters:
index- Column number of the field to extract.- Returns:
- A DbaseData object if the column is within bounds. Otherwise, null.
-
getField
public DbaseData getField(String Name)
Extract the data for a given field by name.- Parameters:
Name- String with the name of the field to retrieve.- Returns:
- A DbaseData object if the name was found or null if not found
-
getDoublesByName
public double[] getDoublesByName(String Name)
Extract the double array of data for a field by Name.- Parameters:
Name- String with the name of the field to retrieve- Returns:
- A double[] if valid numeric field, otherwise null
-
getStringsByName
public String[] getStringsByName(String Name)
Extract the string array of data for a field by Name.- Parameters:
Name- String with the name of the field to retrieve- Returns:
- A String[] if valid character field, otherwise null
-
getBooleansByName
public boolean[] getBooleansByName(String Name)
Extract the boolean array of data for a field by Name.- Parameters:
Name- String with the name of the field to retrieve- Returns:
- A boolean[] if valid character field, otherwise null
-
getFieldName
public String getFieldName(int i)
Get the name of a field by column number.- Parameters:
i- The column number of the field name.- Returns:
- A String with the field name or null if out of bounds
-
getFieldNames
public String[] getFieldNames()
Get a list of all the field names in the dbase file- Returns:
- A String array of all the field names
-
getNumFields
public int getNumFields()
Get the number of fields in the file.- Returns:
- number of fields
-
getNumRecords
public int getNumRecords()
- Returns:
- number of records in the dbase file
-
isLoaded
public boolean isLoaded()
- Returns:
- Boolean true if the data has been loaded, otherwise false.
-
-