public class StreamUtil extends Object
Constructor and Description |
---|
StreamUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
io(InputStream in,
OutputStream out,
boolean closeIn,
boolean closeOut)
从输入流读取内容,写入到输出流中。
|
static void |
io(Reader in,
Writer out,
boolean closeIn,
boolean closeOut)
从输入流读取内容,写入到输出流中。
|
static ByteArray |
readBytes(InputStream in,
boolean closeIn)
将指定
InputStream 的所有内容全部读出到一个byte数组中。 |
static String |
readText(InputStream in,
String charset,
boolean closeIn)
将指定输入流的所有文本全部读出到一个字符串中。
|
static String |
readText(Reader in,
boolean closeIn)
将指定
Reader 的所有文本全部读出到一个字符串中。 |
static void |
writeBytes(byte[] bytes,
OutputStream out,
boolean closeOut)
将byte数组写入到指定
OutputStream 中。 |
static void |
writeBytes(ByteArray bytes,
OutputStream out,
boolean closeOut)
将byte数组写入到指定
OutputStream 中。 |
static void |
writeText(CharSequence chars,
OutputStream out,
String charset,
boolean closeOut)
将字符串写入到指定输出流中。
|
static void |
writeText(CharSequence chars,
Writer out,
boolean closeOut)
将字符串写入到指定
Writer 中。 |
public static void io(InputStream in, OutputStream out, boolean closeIn, boolean closeOut) throws IOException
IOException
public static void io(Reader in, Writer out, boolean closeIn, boolean closeOut) throws IOException
IOException
public static String readText(InputStream in, String charset, boolean closeIn) throws IOException
IOException
public static String readText(Reader in, boolean closeIn) throws IOException
Reader
的所有文本全部读出到一个字符串中。IOException
public static ByteArray readBytes(InputStream in, boolean closeIn) throws IOException
InputStream
的所有内容全部读出到一个byte数组中。IOException
public static void writeText(CharSequence chars, OutputStream out, String charset, boolean closeOut) throws IOException
IOException
public static void writeText(CharSequence chars, Writer out, boolean closeOut) throws IOException
Writer
中。IOException
public static void writeBytes(byte[] bytes, OutputStream out, boolean closeOut) throws IOException
OutputStream
中。IOException
public static void writeBytes(ByteArray bytes, OutputStream out, boolean closeOut) throws IOException
OutputStream
中。IOException
Copyright © 2006–2018 TinyGroup. All rights reserved.