code: public void openFLACStream() throws IOException {
      streamLock.lock();
      try {
        //reset all data.
        reset();
        flacStreamIsOpen = true;
        //write FLAC stream identifier
        out.write(FLAC_id.getData(), 0, FLAC_id.getUsableBits()/8);
        //write stream headers. These must be updated at close of stream
        byte[] md5Hash = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};//blank hash. Don't know it yet.
        EncodedElement streamInfo =  MetadataBlockStreamInfo.getStreamInfo(
            streamConfig, minFrameSize, maxFrameSize, samplesInStream, md5Hash);
        //mark stream info location(so we can return to it and re-write headers,
        //  assuming stream is seekable. Then write header.
        int size = streamInfo.getUsableBits()/8;
        EncodedElement metadataBlockHeader =
            MetadataBlockHeader.getMetadataBlockHeader(false,
            MetadataBlockHeader.MetadataBlockType.STREAMINFO, size);
        this.writeDataToOutput(metadataBlockHeader);
        streamHeaderPos = out.getPos();
        out.write(streamInfo.getData(), 0, size);
        writePaddingToFoolJFlac();
      }finally {
         streamLock.unlock();
      }
    }
docs: Begin a new FLAC stream. Prior to calling this, you must have already
  set the StreamConfiguration and the output stream, both of which must not
  change until encoding is finished and the stream is closed. If this
  FLACEncoder object has already been used to encode a stream, unencoded
  samples may still be stored. Use clear() to dump them prior to calling
  this method(if clear() not called, and samples are instead retained, the
  StreamConfiguration must NOT have changed from the prior stream.
  
  @throws IOException if there is an error writing the headers to output.