public synchronized void resizeFile ( int newsize ) throws IOException { if ( ! writable ) { throw new IOException ( "File is not writeable!" ) ; } // update the number of records this . numrecs = newsize ; file . seek ( HEADER_POS_SIZE ) ; file . writeInt ( numrecs ) ; // resize file file . setLength ( indexToFileposition ( numrecs ) ) ; mapArray ( ) ; }
Resize file to the intended size