code: public void write(BitEncoderChannel headerChannel, EXIFactory f)
  			throws EXIException {
  		try {
  			EncodingOptions headerOptions = f.getEncodingOptions();
  			CodingMode codingMode = f.getCodingMode();
  
  			// EXI Cookie
  			if (headerOptions.isOptionEnabled(EncodingOptions.INCLUDE_COOKIE)) {
  				// four byte field consists of four characters " $ " , " E ",
  				// " X " and " I " in that order
  				headerChannel.encode('$');
  				headerChannel.encode('E');
  				headerChannel.encode('X');
  				headerChannel.encode('I');
  			}
  
  			// Distinguishing Bits 10
  			headerChannel.encodeNBitUnsignedInteger(2, 2);
  
  			// Presence Bit for EXI Options 0
  			boolean includeOptions = headerOptions
  					.isOptionEnabled(EncodingOptions.INCLUDE_OPTIONS);
  			headerChannel.encodeBoolean(includeOptions);
  
  			// EXI Format Version 0-0000
  			headerChannel.encodeBoolean(false); // preview
  			headerChannel.encodeNBitUnsignedInteger(0, 4);
  
  			// EXI Header options and so forth
  			if (includeOptions) {
  				writeEXIOptions(f, headerChannel);
  			}
  
  			// other than bit-packed requires [Padding Bits]
  			if (codingMode != CodingMode.BIT_PACKED) {
  				headerChannel.align();
  				headerChannel.flush();
  			}
  
  		} catch (IOException e) {
  			throw new EXIException(e);
  		}
  	}
docs: Writes the EXI header according to the header options with optional
  cookie, EXI options, ..
  
  @param headerChannel
  header channel
  @param f
  factory
  @throws EXIException
  EXI exception