question: private void validateHeader ( boolean validateRecordSize ) throws IOException { int readmagic = file . readInt ( ) ; if ( readmagic != this . magic ) { file . close ( ) ; throw new IOException ( "Magic in LinearDiskCache does not match: " + readmagic + " instead of " + this . magic ) ; } if ( file . readInt ( ) != this . headersize ) { file . close ( ) ; throw new IOException ( "Header size in LinearDiskCache does not match." ) ; } if ( validateRecordSize ) { if ( file . readInt ( ) != this . recordsize ) { file . close ( ) ; throw new IOException ( "Recordsize in LinearDiskCache does not match." ) ; } } else { this . recordsize = file . readInt ( ) ; } if ( file . getFilePointer ( ) != HEADER_POS_SIZE ) { throw new IOException ( "Incorrect file position when reading header." ) ; } this . numrecs = file . readInt ( ) ; if ( numrecs < 0 || file . length ( ) != indexToFileposition ( numrecs ) ) { throw new IOException ( "File size and number of records do not agree." ) ; } if ( file . getFilePointer ( ) != INTERNAL_HEADER_SIZE ) { throw new IOException ( "Incorrect file position after reading header." ) ; } }
target:  Validates the header and throws an IOException if the header is invalid. If validateRecordSize is set to true the record size must match exactly the stored record size within the files header, else the record size is read from the header and used.