当前位置: 首页>>代码示例>>Java>>正文


Java BoundedInputStream.setPropagateClose方法代码示例

本文整理汇总了Java中org.apache.commons.io.input.BoundedInputStream.setPropagateClose方法的典型用法代码示例。如果您正苦于以下问题:Java BoundedInputStream.setPropagateClose方法的具体用法?Java BoundedInputStream.setPropagateClose怎么用?Java BoundedInputStream.setPropagateClose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.io.input.BoundedInputStream的用法示例。


在下文中一共展示了BoundedInputStream.setPropagateClose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDownloadersInputStream

import org.apache.commons.io.input.BoundedInputStream; //导入方法依赖的package包/类
@Override
protected InputStream getDownloadersInputStream() throws IOException {
    Request request = Request.createGET(sourcePath, connection);
    Response response = request.send();
    fileDetails = response.toFileDetails();

    // TODO: Manage the dependency which includes this class better?
    // Right now, I only needed the one class from apache commons.
    // There are countless classes online which provide this functionality,
    // including some which are available from the Android SDK - the only
    // problem is that they have a funky API which doesn't just wrap a
    // plain old InputStream (the class is ContentLengthInputStream -
    // whereas this BoundedInputStream is much more generic and useful
    // to us).
    BoundedInputStream stream = new BoundedInputStream(response.toContentStream(), fileDetails.getFileSize());
    stream.setPropagateClose(false);

    return stream;
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:20,代码来源:BluetoothDownloader.java

示例2: read

import org.apache.commons.io.input.BoundedInputStream; //导入方法依赖的package包/类
@Override
public Object read(Kryo kryo, Input input, Class type) {

  //First item to read is an integer representing the length of the written byte array
  int lDOMLength = input.readInt();

  //Restrict the InputStream to be read to the length of the serialised DOM, so the DOM constructor doesn't deplete the raw Kryo InputStream
  BoundedInputStream lBoundedInputStream = new BoundedInputStream(input, lDOMLength);
  //Don't allow close calls from the XML deserialiser to propogate to the wrapped InputStream
  lBoundedInputStream.setPropagateClose(false);

  return DOM.createDocument(lBoundedInputStream, false);
}
 
开发者ID:Fivium,项目名称:FOXopen,代码行数:14,代码来源:KryoManager.java

示例3: boundedInputStream

import org.apache.commons.io.input.BoundedInputStream; //导入方法依赖的package包/类
BoundedInputStream boundedInputStream(InputStream inputStream, int length) {
    BoundedInputStream bis = new BoundedInputStream(inputStream, length); // No close() required/ not propagated.
    bis.setPropagateClose(false);
    return bis;
}
 
开发者ID:horrorho,项目名称:InflatableDonkey,代码行数:6,代码来源:ChunkListDecrypter.java


注:本文中的org.apache.commons.io.input.BoundedInputStream.setPropagateClose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。