public class NioTools extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BUFFER_SIZE
默认缓存大小
|
static int |
DEFAULT_LARGE_BUFFER_SIZE
默认缓存大小
|
static int |
EOF
数据流末尾
|
Constructor and Description |
---|
NioTools() |
Modifier and Type | Method and Description |
---|---|
static long |
copyLarge(InputStream inputStream,
OutputStream outputStream,
int bufferSize,
IStreamProgress streamProgress)
复制流
|
static long |
copyLarge(InputStream inputStream,
OutputStream outputStream,
int bufferSize,
long offSet,
IStreamProgress streamProgress)
从输入流的指定位置复制流
|
static long |
copyLarge(ReadableByteChannel inChannel,
WritableByteChannel outChannel,
int bufferSize,
IStreamProgress streamProgress)
复制流
|
static byte[] |
readToByte(InputStream inputStream,
int bufferSize,
IStreamProgress streamProgress)
读取数据流到byte数组
|
static byte[] |
readToByte(InputStream inputStream,
IStreamProgress streamProgress)
读取数据流到byte数组
|
static String |
readToString(InputStream input,
Charset charset)
读取数据流到字符串,并制定字符编码。
缺省使用当前操作系统缺省字符编码(windows 时 GBK,UNIX 是 utf-8) |
static String |
readToStringUTF8(InputStream input)
读取数据流到字符串,以utf-8字符编码
|
public static final int DEFAULT_BUFFER_SIZE
public static final int DEFAULT_LARGE_BUFFER_SIZE
public static final int EOF
public static long copyLarge(InputStream inputStream, OutputStream outputStream, int bufferSize, long offSet, IStreamProgress streamProgress) throws IOException
inputStream
- outputStream
- bufferSize
- offSet
- 读取输入流的起始位置streamProgress
- IOException
public static long copyLarge(InputStream inputStream, OutputStream outputStream, int bufferSize, IStreamProgress streamProgress) throws IOException
inputStream
- outputStream
- bufferSize
- streamProgress
- IOException
public static long copyLarge(ReadableByteChannel inChannel, WritableByteChannel outChannel, int bufferSize, IStreamProgress streamProgress) throws IOException
inChannel
- 输入流通道outChannel
- 输出流通道bufferSize
- 缓存大小streamProgress
- 复制流进度条IOException
public static byte[] readToByte(InputStream inputStream, int bufferSize, IStreamProgress streamProgress) throws IOException
inputStream
- bufferSize
- streamProgress
- IOException
public static byte[] readToByte(InputStream inputStream, IStreamProgress streamProgress) throws IOException
inputStream
- streamProgress
- IOException
public static String readToString(InputStream input, Charset charset) throws IOException
input
- charset
- IOException
public static String readToStringUTF8(InputStream input) throws IOException
input
- IOException
Copyright © 2018. All rights reserved.