class ReleasableInputStream extends InputStream {

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

    public  ReleasableInputStream(InputStream delegate, Runnable onClose);

}