public class IoUtils extends Object
| 构造器和说明 |
|---|
IoUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
readFile(File file)
读取文件
|
static void |
saveFile(File file,
String content)
保存文件
|
static <T extends OutputStream> |
transferTo(InputStream ins,
T out)
将输入流转换为输出流
|
static <T extends OutputStream> |
transferTo(InputStream ins,
T out,
long start,
long length)
将输入流转换为输出流
|
static byte[] |
transferToBytes(InputStream ins)
将输入流转换为byte数组
|
static String |
transferToString(InputStream ins,
String charset)
将输入流转换为字符串
|
public static String transferToString(InputStream ins, String charset) throws IOException
ins - 输入流charset - 字符集IOExceptionpublic static byte[] transferToBytes(InputStream ins) throws IOException
ins - 输入流IOExceptionpublic static <T extends OutputStream> T transferTo(InputStream ins, T out) throws IOException
ins - 输入流out - 输出流IOExceptionpublic static <T extends OutputStream> T transferTo(InputStream ins, T out, long start, long length) throws IOException
ins - 输入流out - 输出流start - 开始位length - 长度IOExceptionpublic static String readFile(File file) throws IOException
IOExceptionpublic static void saveFile(File file, String content) throws IOException
IOExceptionCopyright © 2024. All rights reserved.