public static EncodedElement getMetadataBlockHeader(boolean lastBlock,
      MetadataBlockType type, int length) {
    EncodedElement ele = new EncodedElement(4, 0);
    int encodedLastBlock = (lastBlock) ? 1:0;
    ele.addInt(encodedLastBlock, 1);
    int encodedType = 0;
    MetadataBlockType[] vals = MetadataBlockType.values();
    for(int i = 0; i < vals.length; i++) {
      if(vals[i] == type) {
        encodedType = i;
        break;
      }
    }

    ele.addInt(encodedType, 7);
    ele.addInt(length, 24);
    return ele;
  }
public static EncodedElement getMetadataBlockHeader ( boolean lastBlock , MetadataBlockType type , int length ) { EncodedElement ele = new EncodedElement ( 4 , 0 ) ; int encodedLastBlock = ( lastBlock ) ? 1 : 0 ; ele . addInt ( encodedLastBlock , 1 ) ; int encodedType = 0 ; MetadataBlockType [ ] vals = MetadataBlockType . values ( ) ; for ( int i = 0 ; i < vals . length ; i ++ ) { if ( vals [ i ] == type ) { encodedType = i ; break ; } } ele . addInt ( encodedType , 7 ) ; ele . addInt ( length , 24 ) ; return ele ; }
Create a meta-data block header of the given type, and return the result
in a new EncodedElement(so data is ready to be placed directly in FLAC
stream)

@param lastBlock True if this is the last meta-block in the stream. False
otherwise.

@param type enum indicating which type of block we're creating.
@param length Length of the meta-data block which follows this header.
@return EncodedElement containing the header.