bundles/org.tukani.xz/src/org/tukaani/xz/XZOutputStream.java
public void finish() throws IOException {
        if (!finished) {
            // This checks for pending exceptions so we don't need to
            // worry about it here.
            endBlock();

            try {
                index.encode(out);
                encodeStreamFooter();
            } catch (IOException e) {
                exception = e;
                throw e;
            }

            // Set it to true only if everything goes fine. Setting it earlier
            // would cause repeated calls to finish() do nothing instead of
            // throwing an exception to indicate an earlier error.
            finished = true;
        }
    }
public void finish() throws IOException {
        if (!finished) {
            // This checks for pending exceptions so we don't need to
            // worry about it here.
            endBlock();

            try {
                index.encode(out);
                encodeStreamFooter();
            } catch (IOException e) {
                exception = e;
                throw e;
            }

            // Set it to true only if everything goes fine. Setting it earlier
            // would cause repeated calls to finish() do nothing instead of
            // throwing an exception to indicate an earlier error.
            finished = true;
        }
    }
Finishes compression without closing the underlying stream.
No more data can be written to this stream after finishing
(calling <code>write</code> with an empty buffer is OK).
<p>
Repeated calls to <code>finish()</code> do nothing unless
an exception was thrown by this stream earlier. In that case
the same exception is thrown again.
<p>
After finishing, the stream may be closed normally with
<code>close()</code>. If the stream will be closed anyway, there
usually is no need to call <code>finish()</code> separately.

@throws      XZIOException
XZ Stream has grown too big

@throws      IOException may be thrown by the underlying output stream