Search in sources :

Example 1 with AutoCloseInputStream

use of org.apache.commons.io.input.AutoCloseInputStream in project jackrabbit by apache.

the class PropertyImpl method getStream.

/** Wrapper around {@link #getValue()} */
public InputStream getStream() throws RepositoryException {
    final Binary binary = getValue().getBinary();
    // make sure binary is disposed after stream had been consumed
    return new AutoCloseInputStream(binary.getStream()) {

        @Override
        public void close() throws IOException {
            super.close();
            binary.dispose();
        }
    };
}
Also used : Binary(javax.jcr.Binary) AutoCloseInputStream(org.apache.commons.io.input.AutoCloseInputStream)

Aggregations

Binary (javax.jcr.Binary)1 AutoCloseInputStream (org.apache.commons.io.input.AutoCloseInputStream)1