class ReleasableOutputStream extends OutputStream {

    @Override
    public void close() throws IOException {
        try {
            delegate.close();
        } finally {
            safeClose();
            isClosed = true;
        }
    }

    public  ReleasableOutputStream(OutputStream delegate, Runnable onClose);

}