@ Override public void insertRow ( Object [ ] values ) throws IOException { if ( ! ( values [ geometryFieldIndex ] instanceof Geometry ) ) { if ( values [ geometryFieldIndex ] == null ) { throw new IOException ( "Shape files do not support NULL Geometry values." ) ; } else { throw new IllegalArgumentException ( "Field at " + geometryFieldIndex + " should be an instance of Geometry," + " found " + values [ geometryFieldIndex ] . getClass ( ) + " instead." ) ; } } shapefileWriter . writeGeometry ( ( Geometry ) values [ geometryFieldIndex ] ) ; // Extract the DBF part of the row Object [ ] dbfValues = new Object [ values . length - 1 ] ; // Copy DBF data before geometryFieldIndex if ( geometryFieldIndex > 0 ) { System . arraycopy ( values , 0 , dbfValues , 0 , geometryFieldIndex ) ; } // Copy DBF data after geometryFieldIndex if ( geometryFieldIndex + 1 < values . length ) { System . arraycopy ( values , geometryFieldIndex + 1 , dbfValues , geometryFieldIndex , dbfValues . length - geometryFieldIndex ) ; } dbfDriver . insertRow ( dbfValues ) ; }
Insert values in the row