public class ShapefileDumper extends Object
The collection will be distributed among different shapefiles if needed do respect certain limitations:
Constructor and Description |
---|
ShapefileDumper(File targetDirectory) |
Modifier and Type | Method and Description |
---|---|
boolean |
dump(SimpleFeatureCollection fc)
Dumps the collection into one or more shapefiles.
|
Charset |
getCharset()
The charset used in the DBF files.
|
long |
getMaxDbfSize()
Maximums size of the DBF files being generated
|
long |
getMaxShpSize()
Maximum size of the shapefiles being generated
|
protected String |
getShapeName(SimpleFeatureType schema,
String geometryType)
Returns the shapefile name from the given schema and geometry type.
|
boolean |
isEmptyShapefileAllowed()
Returns true if empty shpaefile dumping is allowed (true by default)
|
void |
setCharset(Charset charset)
Sets the charset used to dump the DBF files.
|
void |
setEmptyShapefileAllowed(boolean emptyShapefileAllowed)
Settings this flag to false will avoid empty shapefiles to be created
|
void |
setMaxDbfSize(long maxDbfSize)
Sets the maximum size of the DBF files the dumper will generate.
|
void |
setMaxShpSize(long maxShapeSize)
Sets the maximum size of the shp files the dumper will generate.
|
protected void |
shapefileDumped(String fileName,
SimpleFeatureType remappedSchema)
Allows subsclasses to perform extra actions against a shapefile that was completely written
|
public ShapefileDumper(File targetDirectory)
public long getMaxShpSize()
public void setMaxShpSize(long maxShapeSize)
public long getMaxDbfSize()
public void setMaxDbfSize(long maxDbfSize)
public Charset getCharset()
public void setCharset(Charset charset)
charset
- public boolean isEmptyShapefileAllowed()
public void setEmptyShapefileAllowed(boolean emptyShapefileAllowed)
emptyShapefileAllowed
- public boolean dump(SimpleFeatureCollection fc) throws IOException
fc
- The input feature collectionIOException
protected void shapefileDumped(String fileName, SimpleFeatureType remappedSchema) throws IOException
fileName
- remappedSchema
- IOException
protected String getShapeName(SimpleFeatureType schema, String geometryType)
schema
- geometryType
- The name of the geometry type, will be null if there is no need for a
geometry type suffixCopyright © 1996–2019 Geotools. All rights reserved.