类 DownloadFileStream

java.lang.Object
com.github.tobato.fastdfs.domain.proto.storage.DownloadFileStream
所有已实现的接口:
DownloadCallback<BufferedInputStream>

public class DownloadFileStream extends Object implements DownloadCallback<BufferedInputStream>
Web环境下文件下载回调方法,默认按4K循环读取,防止下载时内存溢出

 refactor:
 将HttpServletResponse调整为OutputStream对象,
 注意:使用时候在外层做response.getOutputStream(),使用完毕后,在外层做 os.close()
 如:
  os = response.getOutputStream();
  DownloadFileStream stream = new DownloadFileStream(os);
  ...
  os.close();

 
作者:
xulb
  • 构造器详细资料

    • DownloadFileStream

      public DownloadFileStream(OutputStream responseOutputStream)
      从HttpServletResponse对象response.getOutputStream()构造
      参数:
      responseOutputStream - 输出流
    • DownloadFileStream

      public DownloadFileStream(OutputStream responseOutputStream, int bufferLength)
      从HttpServletResponse对象response.getOutputStream()构造
      参数:
      responseOutputStream - 输出流
      bufferLength - 缓存长度
  • 方法详细资料