public MetadataBlockHeader(boolean isLastBlock,BlockType blockType,int dataLength){
  ByteBuffer rawdata=ByteBuffer.allocate(HEADER_LENGTH);
  this.blockType=blockType;
  this.isLastBlock=isLastBlock;
  this.dataLength=dataLength;
  byte type;
  if (isLastBlock) {
    type=(byte)(0x80 | blockType.getId());
  }
 else {
    type=(byte)blockType.getId();
  }
  rawdata.put(type);
  rawdata.put((byte)((dataLength & 0xFF0000) >>> 16));
  rawdata.put((byte)((dataLength & 0xFF00) >>> 8));
  rawdata.put((byte)(dataLength & 0xFF));
  bytes=new byte[HEADER_LENGTH];
  for (int i=0; i < HEADER_LENGTH; i++) {
    bytes[i]=rawdata.get(i);
  }
}

public MetadataBlockHeader ( boolean isLastBlock , BlockType blockType , int dataLength ) { ByteBuffer rawdata = ByteBuffer . allocate ( HEADER_LENGTH ) ; this . blockType = blockType ; this . isLastBlock = isLastBlock ; this . dataLength = dataLength ; byte type ; if ( isLastBlock ) { type = ( byte ) ( 0x80 | blockType . getId ( ) ) ; } else { type = ( byte ) blockType . getId ( ) ; } rawdata . put ( type ) ; rawdata . put ( ( byte ) ( ( dataLength & 0xFF0000 ) > > > 16 ) ) ; rawdata . put ( ( byte ) ( ( dataLength & 0xFF00 ) > > > 8 ) ) ; rawdata . put ( ( byte ) ( dataLength & 0xFF ) ) ; bytes = new byte [ HEADER_LENGTH ] ; for ( int i = 0 ; i < HEADER_LENGTH ; i ++ ) { bytes [ i ] = rawdata . get ( i ) ; } }
construct a new header in order to write metadatablock to file
