@Override public Content createContent(String uri, ContentCreateOptions options, boolean copyCollections, boolean copyMetadata, boolean copyQuality) throws IOException { if (copyCollections || copyMetadata || copyQuality) { setContentOptions(options, copyCollections, copyMetadata, copyQuality); } if (isStreamable()) { InputStream is = null; try { is = getContentAsByteStream(); return ContentFactory.newUnBufferedContent(uri, is, options); } catch (Exception ex) { if (is != null) { is.close(); } throw new IOException("Error accessing large binary document " + uri + ", skipping...", ex); } } else { return ContentFactory.newContent(uri, getContentAsByteArray(), options); } } }