public void initDriver ( File shpFile , ShapeType shapeType , DbaseFileHeader dbaseHeader ) throws IOException { String path = shpFile . getAbsolutePath ( ) ; String nameWithoutExt = path . substring ( 0 , path . lastIndexOf ( ' ' ) ) ; this . shpFile = new File ( nameWithoutExt + ".shp" ) ; this . shxFile = new File ( nameWithoutExt + ".shx" ) ; this . dbfFile = new File ( nameWithoutExt + ".dbf" ) ; FileOutputStream shpFos = new FileOutputStream ( shpFile ) ; FileOutputStream shxFos = new FileOutputStream ( shxFile ) ; shapefileWriter = new ShapefileWriter ( shpFos . getChannel ( ) , shxFos . getChannel ( ) ) ; this . shapeType = shapeType ; shapefileWriter . writeHeaders ( shapeType ) ; dbfDriver . initDriver ( dbfFile , dbaseHeader ) ; }
Init Driver for Write mode