Class ShapefileReader
java.lang.Object
com.vividsolutions.jump.io.AbstractJUMPReader
com.vividsolutions.jump.io.ShapefileReader
- All Implemented Interfaces:
JUMPReader, TaskMonitorSupport
ShapefileReader is a
JUMPReader specialized to read Shapefiles.
DataProperties for the JUMPReader load(DataProperties) interface:
| Parameter | Meaning |
|---|---|
| InputFile or DefaultValue | File name for the input .shp file |
| NOTE: The input .dbf is assumed to be 'beside' (in the same directory) as the .shp file. | |
| CompressedFile | File name (.zip or .tgz NOT a .gz) with .shp and .dbf file inside |
| Uses a modified version of geotools to do the .dbf and .shp file reading. If you are reading from a .zip file, the dbf file will be copied to your temp directory and deleted after being read. | |
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetCharset(String shpFileName, DriverProperties dp) protected InputStreamgetCpgInputStream(String srcFileName, String compressedFname) protected DbfFilegetDbfFile(String srcFileName, String compressedFname, Charset charset) Get's a DbfFile.protected ShapefilegetShapefile(String shpfileName, String compressedFname) protected InputStreamread(DriverProperties dp) Main method to read a shapefile.Methods inherited from class AbstractJUMPReader
addException, getExceptions, getTaskMonitor, setTaskMonitor
-
Constructor Details
-
ShapefileReader
public ShapefileReader()Creates new ShapeReader
-
-
Method Details
-
read
Main method to read a shapefile. Most of the work is done in the org.geotools.* package.- Specified by:
readin interfaceJUMPReader- Specified by:
readin classAbstractJUMPReader- Parameters:
dp- 'InputFile' or 'DefaultValue' to specify output .shp file.- Returns:
- a FeatureCollection created from .shp and .dbf (dbf is optional)
- Throws:
Exception
-
getShapefile
-
getShx
- Throws:
Exception
-
getCharset
- Throws:
Exception
-
getCpgInputStream
protected InputStream getCpgInputStream(String srcFileName, String compressedFname) throws Exception - Throws:
Exception
-
getDbfFile
protected DbfFile getDbfFile(String srcFileName, String compressedFname, Charset charset) throws IOException Get's a DbfFile. Kept, for compatibilty. Use the method with charset parameter.- Parameters:
srcFileName- either a pass to a dbf or an archive file (*.zip etc.) accompanied by the compressedFname it containscompressedFname- the name of the compressed entry in the compressed file or nullcharset- the charset to use to read this dbf file- Returns:
- a DbfFile object for the dbf file named FileName
- Throws:
IOException- if an I/O error occurs during dbf file reading
-