public class StreamUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BUFFER_SIZE
缓冲字节大小
|
static int |
COMPRESS_BUFFER
压缩缓冲字节大小
|
| Constructor and Description |
|---|
StreamUtil() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
compress(byte[] sourceData)
数据压缩
|
static void |
compress(InputStream inputStream,
OutputStream outputStream)
数据压缩
|
static String |
compressBase64String(String sourceData)
使用 Base64 进行数据压缩
|
static byte[] |
compressString(String sourceData)
数据压缩
|
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.
|
static byte[] |
decompress(byte[] sourceData)
数据解压缩
|
static void |
decompress(InputStream inputStream,
OutputStream outputStream)
数据解压缩
|
static String |
decompressBase64String(String sourceData)
使用 Base64 进行数据解压缩
|
static String |
decompressString(byte[] sourceData)
数据解压缩
|
public static final int BUFFER_SIZE
public static final int COMPRESS_BUFFER
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)public static void compress(InputStream inputStream, OutputStream outputStream)
inputStream - 待压缩的数据流outputStream - 压缩后的数据流public static void decompress(InputStream inputStream, OutputStream outputStream)
inputStream - 待解压的数据流outputStream - 解压后的数据流public static byte[] compress(byte[] sourceData)
sourceData - 待压缩的原始数据public static byte[] decompress(byte[] sourceData)
sourceData - 待解压的数据public static byte[] compressString(String sourceData)
sourceData - 待压缩的原始数据public static String decompressString(byte[] sourceData)
sourceData - 待解压的数据public static String compressBase64String(String sourceData)
sourceData - 待压缩的原始数据Copyright © 2018–2020 Pivotal Software, Inc.. All rights reserved.