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

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

本文整理了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

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);
}

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

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);
}

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

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

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

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

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

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

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

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

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

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

相关文章