private void handleInputStream(Message message, InputStream is) throws IOException { CachedOutputStream bos = new CachedOutputStream(); if (threshold > 0) { bos.setThreshold(threshold); } // use the appropriate input stream and restore it later InputStream bis = is instanceof DelegatingInputStream ? ((DelegatingInputStream)is).getInputStream() : is; // only copy up to the limit since that's all we need to log // we can stream the rest IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit); bos.flush(); bis = new SequenceInputStream(bos.getInputStream(), bis); // restore the delegating input stream or the input stream if (is instanceof DelegatingInputStream) { ((DelegatingInputStream)is).setInputStream(bis); } else { message.setContent(InputStream.class, bis); } message.setContent(CachedOutputStream.class, bos); }
private void handleInputStream(Message message, InputStream is) throws IOException { CachedOutputStream bos = new CachedOutputStream(); if (threshold > 0) { bos.setThreshold(threshold); } // use the appropriate input stream and restore it later InputStream bis = is instanceof DelegatingInputStream ? ((DelegatingInputStream)is).getInputStream() : is; // only copy up to the limit since that's all we need to log // we can stream the rest IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit); bos.flush(); bis = new SequenceInputStream(bos.getInputStream(), bis); // restore the delegating input stream or the input stream if (is instanceof DelegatingInputStream) { ((DelegatingInputStream)is).setInputStream(bis); } else { message.setContent(InputStream.class, bis); } message.setContent(CachedOutputStream.class, bos); }
IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit); bos.flush(); bis = new SequenceInputStream(bos.getInputStream(), bis);
IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit); bos.flush(); bis = new SequenceInputStream(bos.getInputStream(), bis);
IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit); bos.flush(); bis = new SequenceInputStream(bos.getInputStream(), bis);
IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit); bos.flush(); bis = new SequenceInputStream(bos.getInputStream(), bis);
IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit); bos.flush(); bis = new SequenceInputStream(bos.getInputStream(), bis);