[ 
https://issues.apache.org/jira/browse/SANDBOX-194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Liebig updated SANDBOX-194:
----------------------------------


Patch:

    boolean closed = false;
    boolean finished = false;

    protected void finalize() throws Throwable {
        close();
        super.finalize();
    }

    /**
     * Finishes writing compressed data to the output stream without closing 
the underlying stream.
     * Use this method when applying multiple filters in succession to the same 
output stream.
     * 
     * @throws IOException
     */
    public void finish() throws IOException {
        if ( finished ) {
            return;
        }

        if ( runLength > 0 ) {
            writeRun();
        }
        currentChar = -1;
        endBlock();
        endCompression();
        flush();
        finished = true;
    }

    public void close() throws IOException {
        if ( closed ) {
            return;
        }

        finish();
        closed = true;
        super.close();
        bsStream.close();
    }


> Create a finish() method similar to the 
> java.util.zip.GZIPOutputStream#finish()
> -------------------------------------------------------------------------------
>
>                 Key: SANDBOX-194
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-194
>             Project: Commons Sandbox
>          Issue Type: New Feature
>            Reporter: Stefan Liebig
>            Priority: Minor
>
> In order to write mixed (compressed/not comressed) data into an output stream 
> it would be helpful if the CBZip2OutputStream would implement a finish() 
> method, which is almost the same as the close() method but does not close the 
> underlying output stream, so that writing to this stream can be continued.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to