org.apache.cxf.helpers.IOUtils.copyAtLeast()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(170)

本文整理了Java中org.apache.cxf.helpers.IOUtils.copyAtLeast()方法的一些代码示例,展示了IOUtils.copyAtLeast()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.copyAtLeast()方法的具体详情如下:
包路径:org.apache.cxf.helpers.IOUtils
类名称:IOUtils
方法名:copyAtLeast

IOUtils.copyAtLeast介绍

[英]Copy at least the specified number of bytes from the input to the output or until the inputstream is finished.
[中]将至少指定数量的字节从输入复制到输出,或直到inputstream完成。

代码示例

代码示例来源:origin: apache/cxf

  1. private void handleInputStream(Message message, InputStream is) throws IOException {
  2. CachedOutputStream bos = new CachedOutputStream();
  3. if (threshold > 0) {
  4. bos.setThreshold(threshold);
  5. }
  6. // use the appropriate input stream and restore it later
  7. InputStream bis = is instanceof DelegatingInputStream
  8. ? ((DelegatingInputStream)is).getInputStream() : is;
  9. // only copy up to the limit since that's all we need to log
  10. // we can stream the rest
  11. IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit);
  12. bos.flush();
  13. bis = new SequenceInputStream(bos.getInputStream(), bis);
  14. // restore the delegating input stream or the input stream
  15. if (is instanceof DelegatingInputStream) {
  16. ((DelegatingInputStream)is).setInputStream(bis);
  17. } else {
  18. message.setContent(InputStream.class, bis);
  19. }
  20. message.setContent(CachedOutputStream.class, bos);
  21. }

代码示例来源:origin: org.apache.cxf/cxf-rt-features-logging

  1. private void handleInputStream(Message message, InputStream is) throws IOException {
  2. CachedOutputStream bos = new CachedOutputStream();
  3. if (threshold > 0) {
  4. bos.setThreshold(threshold);
  5. }
  6. // use the appropriate input stream and restore it later
  7. InputStream bis = is instanceof DelegatingInputStream
  8. ? ((DelegatingInputStream)is).getInputStream() : is;
  9. // only copy up to the limit since that's all we need to log
  10. // we can stream the rest
  11. IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit);
  12. bos.flush();
  13. bis = new SequenceInputStream(bos.getInputStream(), bis);
  14. // restore the delegating input stream or the input stream
  15. if (is instanceof DelegatingInputStream) {
  16. ((DelegatingInputStream)is).setInputStream(bis);
  17. } else {
  18. message.setContent(InputStream.class, bis);
  19. }
  20. message.setContent(CachedOutputStream.class, bos);
  21. }

代码示例来源:origin: org.apache.cxf/cxf-core

  1. IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit);
  2. bos.flush();
  3. bis = new SequenceInputStream(bos.getInputStream(), bis);

代码示例来源:origin: apache/cxf

  1. IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit);
  2. bos.flush();
  3. bis = new SequenceInputStream(bos.getInputStream(), bis);

代码示例来源:origin: org.apache.cxf/cxf-api

  1. IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit);
  2. bos.flush();
  3. bis = new SequenceInputStream(bos.getInputStream(), bis);

代码示例来源:origin: openl-tablets/openl-tablets

  1. IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit);
  2. bos.flush();
  3. bis = new SequenceInputStream(bos.getInputStream(), bis);

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

  1. IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit);
  2. bos.flush();
  3. bis = new SequenceInputStream(bos.getInputStream(), bis);

相关文章