public class ShapefileWriter extends Object
   GeometryCollection geoms;
   File shp = new File("myshape.shp");
   File shx = new File("myshape.shx");
   ShapefileWriter writer = new ShapefileWriter(
     shp.getChannel(),shx.getChannel()
   );
   writer.write(geoms,ShapeType.ARC);
  This example assumes that each shape in the collection is a LineString.ShapefileDataStore| Constructor and Description | 
|---|
| ShapefileWriter(FileChannel shpChannel,
               FileChannel shxChannel)Creates a new instance of ShapeFileWriter | 
| Modifier and Type | Method and Description | 
|---|---|
| void | close()Close the underlying Channels. | 
| void | skipHeaders()Allocate internal buffers and position the channels to the beginning or the record section of
 the shapefile. | 
| void | write(GeometryCollection geometries,
     ShapeType type)Bulk write method for writing a collection of (hopefully) like geometries of the given
 ShapeType. | 
| void | writeGeometry(Geometry g)Write a single Geometry to this shapefile. | 
| void | writeHeaders(Envelope bounds,
            ShapeType type,
            int numberOfGeometries,
            int fileLength)Write the headers for this shapefile including the bounds, shape type, the number of
 geometries and the total fileLength (in actual bytes, NOT 16 bit words). | 
| protected int | writeNullGeometry() | 
public ShapefileWriter(FileChannel shpChannel, FileChannel shxChannel) throws IOException
IOExceptionpublic void writeHeaders(Envelope bounds,
                         ShapeType type,
                         int numberOfGeometries,
                         int fileLength)
                  throws IOException
IOExceptionpublic void skipHeaders()
                 throws IOException
IOExceptionpublic void writeGeometry(Geometry g)
                   throws IOException
IOExceptionprotected int writeNullGeometry()
                         throws IOException
IOExceptionpublic void close()
           throws IOException
IOExceptionpublic void write(GeometryCollection geometries,
                  ShapeType type)
           throws IOException,
                  ShapefileException
IOExceptionShapefileExceptionCopyright © 1996–2019 Geotools. All rights reserved.