/** * Constructs a FileHeader object from a block. * * @param block The block that contains the file header * @param isNew If true, the file header is for a new file. * @throws IOException if the block is too short to keep the file * header. */ FileHeader(BlockIo block, boolean isNew) { this.block = block; if (isNew) block.writeShort(O_MAGIC, Magic.FILE_HEADER); else if (!magicOk()) throw new Error("CRITICAL: file header magic not OK " + block.readShort(O_MAGIC)); }