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 ( ' ' ) ; headerChannel . encode ( ' ' ) ; headerChannel . encode ( ' ' ) ; } // 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 ) ; } }
Writes the EXI header according to the header options with optional cookie EXI options ..