public void finish() throws IOException {
  if (!this.wroteLastChunk) {
    flushCache();
    writeClosingChunk();
    this.wroteLastChunk=true;
  }
}

public void finish ( ) throws IOException { if ( ! this . wroteLastChunk ) { flushCache ( ) ; writeClosingChunk ( ) ; this . wroteLastChunk = true ; } }
must be called to ensure the internal cache is flushed and the closing chunk is written .
