private void cacheStreamedAttachments() throws IOException { if (body instanceof DelegatingInputStream && !((DelegatingInputStream) body).isClosed()) { cache((DelegatingInputStream) body); } List<Attachment> atts = new ArrayList<>(attachments.getLoadedAttachments()); for (Attachment a : atts) { DataSource s = a.getDataHandler().getDataSource(); if (s instanceof AttachmentDataSource) { AttachmentDataSource ads = (AttachmentDataSource)s; if (!ads.isCached()) { ads.cache(message); } } else if (s.getInputStream() instanceof DelegatingInputStream) { cache((DelegatingInputStream) s.getInputStream()); } else { //assume a normal stream that is already cached } } }
private void cacheStreamedAttachments() throws IOException { if (body instanceof DelegatingInputStream && !((DelegatingInputStream) body).isClosed()) { cache((DelegatingInputStream) body); } List<Attachment> atts = new ArrayList<>(attachments.getLoadedAttachments()); for (Attachment a : atts) { DataSource s = a.getDataHandler().getDataSource(); if (s instanceof AttachmentDataSource) { AttachmentDataSource ads = (AttachmentDataSource)s; if (!ads.isCached()) { ads.cache(message); } } else if (s.getInputStream() instanceof DelegatingInputStream) { cache((DelegatingInputStream) s.getInputStream()); } else { //assume a normal stream that is already cached } } }
private void cacheStreamedAttachments() throws IOException { if (body instanceof DelegatingInputStream && !((DelegatingInputStream) body).isClosed()) { cache((DelegatingInputStream) body, true); } List<Attachment> atts = new ArrayList<Attachment>(attachments.getLoadedAttachments()); for (Attachment a : atts) { DataSource s = a.getDataHandler().getDataSource(); if (s instanceof AttachmentDataSource) { AttachmentDataSource ads = (AttachmentDataSource)s; if (!ads.isCached()) { ads.cache(message); } } else if (s.getInputStream() instanceof DelegatingInputStream) { cache((DelegatingInputStream) s.getInputStream(), false); } else { //assume a normal stream that is already cached } } }
private void cacheStreamedAttachments() throws IOException { if (body instanceof DelegatingInputStream && !((DelegatingInputStream) body).isClosed()) { cache((DelegatingInputStream) body, true); } List<Attachment> atts = new ArrayList<Attachment>(attachments.getLoadedAttachments()); for (Attachment a : atts) { DataSource s = a.getDataHandler().getDataSource(); if (s instanceof AttachmentDataSource) { AttachmentDataSource ads = (AttachmentDataSource)s; if (!ads.isCached()) { ads.cache(message); } } else if (s.getInputStream() instanceof DelegatingInputStream) { cache((DelegatingInputStream) s.getInputStream(), false); } else { //assume a normal stream that is already cached } } }