boolean recordsChanged = false;
    public void verify(boolean repair, boolean verbose) throws IOException {        // Is file length stored in header correctly?        // Is file bounding box correct?        // Does file have a valid shape type?        // Is each record the correct shape type?        // Does each record header have the correct record number?        // Do we reach EOF at the end of a record?        boolean headerChanged = false;        boolean recordsChanged = false;        long fLen = raf.length();        if (verbose) {            Debug.output("Checking file length...");            System.out.flush();        }        if (fileLength == fLen) {            if (verbose) {                Debug.output("correct.");            }        } else {            if (verbose) {                Debug.output("incorrect (got " + fileLength + ", should be "                        + fLen + ")");            }            if (repair) {                fileLength = fLen;                writeBEInt(header, 24, ((int) fLen / 2));                headerChanged = true;                if (verbose) {                    Debug.output("...repaired.");                }            }        }        // loop through file to verify:        //   record numbers        //   Shape types        //   bounding box        //   correct EOF        raf.seek(100);        ESRIRecord r;        int nRecords = 0;        Vector v = new Vector();        ESRIBoundingBox bounds = new ESRIBoundingBox();        long recStart = raf.getFilePointer();        byte intBuf[] = new byte[4];        while ((r = getNextRecord()) != null) {            long recEnd = raf.getFilePointer();            //          Debug.output("verify - start: " + recStart +            //                             "; end: " + recEnd);            nRecords++;            v.addElement(r);            if (r.getRecordNumber() != nRecords) {                //              Debug.output("updating record number for record "                //                                 + nRecords);                writeBEInt(intBuf, 0, nRecords);                raf.seek(recStart);                raf.write(intBuf, 0, 4);                raf.seek(recEnd);            }            if (fileShapeType == SHAPE_TYPE_NULL) {                Debug.output("updating shape type in header.");                fileShapeType = r.getShapeType();                writeLEInt(header, 32, fileShapeType);                headerChanged = true;            }            if (r.getShapeType() != fileShapeType) {                Debug.output("invalid shape type " + r.getShapeType()                        + ", expecting " + fileShapeType);            }            bounds.addBounds(r.getBoundingBox());            recStart = recEnd;        }        if (!fileBounds.equals(bounds)) {            Debug.output("adjusting bounds");            Debug.output("from min: " + fileBounds.min);            Debug.output("to min: " + bounds.min);            Debug.output("from max: " + fileBounds.max);            Debug.output("to max: " + bounds.max);            writeBox(header, 36, bounds);            headerChanged = true;            fileBounds = bounds;        }        if (headerChanged) {            Debug.output("writing changed header");            raf.seek(0);            raf.write(header, 0, 100);        }    }