private void writeHeader ( ESRIBounds box , ShapeElementType type , Collection < ? extends E > elements ) throws IOException { if ( ! this . headerWasWritten ) { initializeContentBuffer ( ) ; box . ensureMinMax ( ) ; //Byte 0 : File Code (9994) writeBEInt ( SHAPE_FILE_CODE ) ; //Byte 4 : Unused (0) writeBEInt ( 0 ) ; //Byte 8 : Unused (0) writeBEInt ( 0 ) ; //Byte 12 : Unused (0) writeBEInt ( 0 ) ; //Byte 16 : Unused (0) writeBEInt ( 0 ) ; //Byte 20 : Unused (0) writeBEInt ( 0 ) ; //Byte 24 : File Length, fill later writeBEInt ( 0 ) ; //Byte 28 : Version(1000) writeLEInt ( SHAPE_FILE_VERSION ) ; //Byte 32 : ShapeType writeLEInt ( type . shapeType ) ; //Byte 36 : Xmin writeLEDouble ( toESRI_x ( box . getMinX ( ) ) ) ; //Byte 44 : Ymin writeLEDouble ( toESRI_y ( box . getMinY ( ) ) ) ; //Byte 52 : Xmax writeLEDouble ( toESRI_x ( box . getMaxX ( ) ) ) ; //Byte 60 : Ymax writeLEDouble ( toESRI_y ( box . getMaxY ( ) ) ) ; //Byte 68 : Zmin writeLEDouble ( toESRI_z ( box . getMinZ ( ) ) ) ; //Byte 76 : Zmax writeLEDouble ( toESRI_z ( box . getMaxZ ( ) ) ) ; //Byte 84 : Mmin writeLEDouble ( toESRI_m ( box . getMinM ( ) ) ) ; //Byte 92 : Mmax writeLEDouble ( toESRI_m ( box . getMaxM ( ) ) ) ; this . headerWasWritten = true ; this . recordIndex = 0 ; onHeaderWritten ( box , type , elements ) ; } }
Write the header of a Shape file .