code: @Override
      public void writeHeader() throws IOException {
          // create a buffer
          ByteBuffer buf = ByteBuffer.allocate(HEADER_LENGTH + 4); // FLVHeader (9 bytes) + PreviousTagSize0 (4 bytes)
          // instance an flv header
          FLVHeader flvHeader = new FLVHeader();
          flvHeader.setFlagAudio(audioCodecId != -1 ? true : false);
          flvHeader.setFlagVideo(videoCodecId != -1 ? true : false);
          // write the flv header in the buffer
          flvHeader.write(buf);
          // the final version of the file will go here
          createOutputFile();
          // write header to output channel
          bytesWritten = fileChannel.write(buf);
          assert ((HEADER_LENGTH + 4) - bytesWritten == 0);
          log.debug("Header size: {} bytes written: {}", (HEADER_LENGTH + 4), bytesWritten);
          buf.clear();
          buf = null;
      }
docs: Writes the header bytes
  
  @throws IOException
  Any I/O exception