question: public void writeHeader ( ) throws IOException { FLVHeader flvHeader = new FLVHeader ( ) ; flvHeader . setFlagAudio ( true ) ; flvHeader . setFlagVideo ( true ) ; ByteBuffer header = ByteBuffer . allocate ( HEADER_LENGTH + 4 ) ; flvHeader . write ( header ) ; file . setLength ( HEADER_LENGTH + 4 ) ; if ( header . hasArray ( ) ) { log . debug ( "Header bytebuffer has a backing array" ) ; file . write ( header . array ( ) ) ; } else { log . debug ( "Header bytebuffer does not have a backing array" ) ; byte [ ] tmp = new byte [ HEADER_LENGTH + 4 ] ; header . get ( tmp ) ; file . write ( tmp ) ; } bytesWritten = file . length ( ) ; header . clear ( ) ; }
target:  Writes the header bytes