void write(BlockId blk,IoBuffer buffer){
  try {
    IoChannel fileChannel=getFileChannel(blk.fileName());
    buffer.rewind();
    fileChannel.write(buffer,blk.number() * BLOCK_SIZE);
  }
 catch (  IOException e) {
    e.printStackTrace();
    throw new RuntimeException("cannot write block" + blk);
  }
}

void write ( BlockId blk , IoBuffer buffer ) { try { IoChannel fileChannel = getFileChannel ( blk . fileName ( ) ) ; buffer . rewind ( ) ; fileChannel . write ( buffer , blk . number ( ) * BLOCK_SIZE ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw new RuntimeException ( "cannot write block" + blk ) ; } }
writes the contents of a byte buffer into a disk block .
