private void cache(DelegatingInputStream input) throws IOException { if (loaded.contains(input)) { return; } loaded.add(input); InputStream origIn = input.getInputStream(); try (CachedOutputStream out = new CachedOutputStream()) { AttachmentUtil.setStreamedAttachmentProperties(message, out); IOUtils.copy(input, out); input.setInputStream(out.getInputStream()); origIn.close(); } }
private void cache(DelegatingInputStream input) throws IOException { if (loaded.contains(input)) { return; } loaded.add(input); InputStream origIn = input.getInputStream(); try (CachedOutputStream out = new CachedOutputStream()) { AttachmentUtil.setStreamedAttachmentProperties(message, out); IOUtils.copy(input, out); input.setInputStream(out.getInputStream()); origIn.close(); } }
private void cache(DelegatingInputStream input, boolean deleteOnClose) throws IOException { if (loaded.contains(input)) { return; } loaded.add(input); CachedOutputStream out = null; InputStream origIn = input.getInputStream(); try { out = new CachedOutputStream(); AttachmentUtil.setStreamedAttachmentProperties(message, out); IOUtils.copy(input, out); input.setInputStream(out.getInputStream()); origIn.close(); } finally { if (out != null) { out.close(); } } }
private void cache(DelegatingInputStream input, boolean deleteOnClose) throws IOException { if (loaded.contains(input)) { return; } loaded.add(input); CachedOutputStream out = null; InputStream origIn = input.getInputStream(); try { out = new CachedOutputStream(); AttachmentUtil.setStreamedAttachmentProperties(message, out); IOUtils.copy(input, out); input.setInputStream(out.getInputStream()); origIn.close(); } finally { if (out != null) { out.close(); } } }
public void cache(Message message) throws IOException { if (cache == null) { cache = new CachedOutputStream(); AttachmentUtil.setStreamedAttachmentProperties(message, cache); try { IOUtils.copy(ins, cache); cache.lockOutputStream(); if (delegate != null) { delegate.setInputStream(cache.getInputStream()); } } catch (CacheSizeExceededException | IOException cee) { cache.close(); cache = null; throw cee; } finally { try { ins.close(); } catch (Exception ex) { //ignore } ins = null; } } } public void hold(Message message) throws IOException {
public void cache(Message message) throws IOException { if (cache == null) { cache = new CachedOutputStream(); AttachmentUtil.setStreamedAttachmentProperties(message, cache); try { IOUtils.copy(ins, cache); cache.lockOutputStream(); if (delegate != null) { delegate.setInputStream(cache.getInputStream()); } } catch (CacheSizeExceededException | IOException cee) { cache.close(); cache = null; throw cee; } finally { try { ins.close(); } catch (Exception ex) { //ignore } ins = null; } } } public void hold(Message message) throws IOException {
public void cache(Message message) throws IOException { if (cache == null) { cache = new CachedOutputStream(); AttachmentUtil.setStreamedAttachmentProperties(message, cache); try { IOUtils.copy(ins, cache); cache.lockOutputStream(); if (delegate != null) { delegate.setInputStream(cache.getInputStream()); } } catch (CacheSizeExceededException cee) { cache.close(); cache = null; throw cee; } catch (IOException cee) { cache.close(); cache = null; throw cee; } finally { try { ins.close(); } catch (Exception ex) { //ignore } ins = null; } } } public void hold(Message message) throws IOException {
public void cache(Message message) throws IOException { if (cache == null) { cache = new CachedOutputStream(); AttachmentUtil.setStreamedAttachmentProperties(message, cache); try { IOUtils.copy(ins, cache); cache.lockOutputStream(); if (delegate != null) { delegate.setInputStream(cache.getInputStream()); } } catch (CacheSizeExceededException cee) { cache.close(); cache = null; throw cee; } catch (IOException cee) { cache.close(); cache = null; throw cee; } finally { try { ins.close(); } catch (Exception ex) { //ignore } ins = null; } } } public void hold(Message message) throws IOException {