public class StreamUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BUFFER_SIZE
缓冲字节大小
|
| Constructor and Description |
|---|
StreamUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
copy(byte[] in,
OutputStream out)
Copy the contents of the given byte array to the given OutputStream.
|
static int |
copy(InputStream in,
OutputStream out)
Copy the contents of the given InputStream to the given OutputStream.
|
static void |
copy(String in,
Charset charset,
OutputStream out)
Copy the contents of the given String to the given output OutputStream.
|
static byte[] |
copyToByteArray(InputStream in)
Copy the contents of the given InputStream into a new byte array.
|
static String |
copyToString(InputStream in,
Charset charset)
Copy the contents of the given InputStream into a String.
|
public static final int BUFFER_SIZE
public static byte[] copyToByteArray(InputStream in)
in - the stream to copy from (may be null or empty)public static String copyToString(InputStream in, Charset charset)
in - the InputStream to copy from (may be null or empty)charset - the InputStream charsetStreamUtils.copyToString(InputStream,
Charset)public static void copy(byte[] in,
OutputStream out)
in - the byte array to copy fromout - the OutputStream to copy toStreamUtils.copy(byte[], OutputStream)public static void copy(String in, Charset charset, OutputStream out)
in - the String to copy fromcharset - the Charsetout - the OutputStream to copy toStreamUtils.copy(String, Charset,
OutputStream)public static int copy(InputStream in, OutputStream out)
in - the InputStream to copy fromout - the OutputStream to copy toStreamUtils.copy(InputStream, OutputStream)Copyright © 2018. All rights reserved.