Package | Description |
---|---|
cn.hutool.core.io |
IO相关封装和工具类,包括Inputstream和OutputStream实现类,工具包括流工具IoUtil、文件工具FileUtil和Buffer工具BufferUtil
|
cn.hutool.core.io.copy |
IO流拷贝相关封装相关封装
|
cn.hutool.http |
Hutool-http针对JDK的HttpUrlConnection做一层封装,简化了HTTPS请求、文件上传、Cookie记忆等操作,使Http请求变得无比简单。
|
Modifier and Type | Method and Description |
---|---|
static long |
IoUtil.copy(InputStream in,
OutputStream out,
int bufferSize,
long count,
StreamProgress streamProgress)
拷贝流,拷贝后不关闭流
|
static long |
IoUtil.copy(InputStream in,
OutputStream out,
int bufferSize,
StreamProgress streamProgress)
拷贝流,拷贝后不关闭流
|
static long |
NioUtil.copy(ReadableByteChannel in,
WritableByteChannel out,
int bufferSize,
long count,
StreamProgress streamProgress)
拷贝流,使用NIO,不会关闭channel
|
static long |
NioUtil.copy(ReadableByteChannel in,
WritableByteChannel out,
int bufferSize,
StreamProgress streamProgress)
拷贝流,使用NIO,不会关闭channel
|
static long |
IoUtil.copy(Reader reader,
Writer writer,
int bufferSize,
long count,
StreamProgress streamProgress)
将Reader中的内容复制到Writer中,拷贝后不关闭Reader
|
static long |
IoUtil.copy(Reader reader,
Writer writer,
int bufferSize,
StreamProgress streamProgress)
将Reader中的内容复制到Writer中,拷贝后不关闭Reader
|
static long |
NioUtil.copyByNIO(InputStream in,
OutputStream out,
int bufferSize,
long count,
StreamProgress streamProgress)
拷贝流
本方法不会关闭流 |
static long |
NioUtil.copyByNIO(InputStream in,
OutputStream out,
int bufferSize,
StreamProgress streamProgress)
拷贝流 thanks to: https://github.com/venusdrogon/feilong-io/blob/master/src/main/java/com/feilong/io/IOWriteUtil.java
本方法不会关闭流 |
Modifier and Type | Field and Description |
---|---|
protected StreamProgress |
IoCopier.progress
进度条
|
Constructor and Description |
---|
ChannelCopier(int bufferSize,
long count,
StreamProgress progress)
构造
|
IoCopier(int bufferSize,
long count,
StreamProgress progress)
构造
|
ReaderWriterCopier(int bufferSize,
long count,
StreamProgress progress)
构造
|
StreamCopier(int bufferSize,
long count,
StreamProgress progress)
构造
|
Modifier and Type | Method and Description |
---|---|
static long |
HttpUtil.download(String url,
OutputStream out,
boolean isCloseOut,
StreamProgress streamProgress)
下载远程文件
|
static long |
HttpDownloader.download(String url,
OutputStream out,
boolean isCloseOut,
StreamProgress streamProgress)
下载远程文件
|
static long |
HttpUtil.downloadFile(String url,
File destFile,
int timeout,
StreamProgress streamProgress)
下载远程文件
|
static long |
HttpDownloader.downloadFile(String url,
File targetFileOrDir,
int timeout,
StreamProgress streamProgress)
下载远程文件
|
static long |
HttpUtil.downloadFile(String url,
File destFile,
StreamProgress streamProgress)
下载远程文件
|
static long |
HttpDownloader.downloadFile(String url,
File targetFileOrDir,
String tempFileSuffix,
int timeout,
StreamProgress streamProgress)
下载文件-避免未完成的文件
来自:https://gitee.com/dromara/hutool/pulls/407 此方法原理是先在目标文件同级目录下创建临时文件,下载之,等下载完毕后重命名,避免因下载错误导致的文件不完整。 |
static File |
HttpUtil.downloadFileFromUrl(String url,
File destFile,
int timeout,
StreamProgress streamProgress)
下载远程文件
|
static File |
HttpUtil.downloadFileFromUrl(String url,
File destFile,
StreamProgress streamProgress)
下载远程文件
|
static File |
HttpDownloader.downloadForFile(String url,
File targetFileOrDir,
int timeout,
StreamProgress streamProgress)
下载远程文件,返回文件
|
static String |
HttpUtil.downloadString(String url,
Charset customCharset,
StreamProgress streamPress)
下载远程文本
|
static String |
HttpDownloader.downloadString(String url,
Charset customCharset,
StreamProgress streamPress)
下载远程文本
|
long |
HttpResponse.writeBody(File targetFileOrDir,
StreamProgress streamProgress)
将响应内容写出到文件
异步模式下直接读取Http流写出,同步模式下将存储在内存中的响应内容写出 写出后会关闭Http流(异步模式) |
long |
HttpResponse.writeBody(File targetFileOrDir,
String tempFileSuffix,
StreamProgress streamProgress)
将响应内容写出到文件-避免未完成的文件
异步模式下直接读取Http流写出,同步模式下将存储在内存中的响应内容写出 写出后会关闭Http流(异步模式) 来自:https://gitee.com/dromara/hutool/pulls/407 此方法原理是先在目标文件同级目录下创建临时文件,下载之,等下载完毕后重命名,避免因下载错误导致的文件不完整。 |
long |
HttpResponse.writeBody(OutputStream out,
boolean isCloseOut,
StreamProgress streamProgress)
|
File |
HttpResponse.writeBodyForFile(File targetFileOrDir,
StreamProgress streamProgress)
将响应内容写出到文件
异步模式下直接读取Http流写出,同步模式下将存储在内存中的响应内容写出 写出后会关闭Http流(异步模式) |
Copyright © 2024. All rights reserved.