Class | Description |
---|---|
BOMInputStream |
读取带BOM头的流内容,
getCharset() 方法调用后会得到BOM头的编码,且会去除BOM头BOM定义:http://www.unicode.org/unicode/faq/utf_bom.html 00 00 FE FF = UTF-32, big-endian FF FE 00 00 = UTF-32, little-endian EF BB BF = UTF-8 FE FF = UTF-16, big-endian FF FE = UTF-16, little-endian 使用:
String enc = "UTF-8"; // or NULL to use systemdefault
参考: http://www.unicode.org/unicode/faq/utf_bom.html |
EmptyInputStream |
空的流
|
EmptyOutputStream |
此OutputStream写出数据到/dev/null,即忽略所有数据
来自 Apache Commons io |
FastByteArrayOutputStream |
基于快速缓冲FastByteBuffer的OutputStream,随着数据的增长自动扩充缓冲区
可以通过
FastByteArrayOutputStream.toByteArray() 和 FastByteArrayOutputStream.toString() 来获取数据
FastByteArrayOutputStream.close() 方法无任何效果,当流被关闭后不会抛出IOException
这种设计避免重新分配内存块而是分配新增的缓冲区,缓冲区不会被GC,数据也不会被拷贝到其他缓冲区。 |
LimitedInputStream |
限制读取最大长度的
FilterInputStream 实现 |
LineCounter |
行数计数器
|
LineInputStream |
行读取器,类似于BufferedInputStream,支持多行转义,规则如下:
支持'\n'和'\r\n'两种换行符,不支持'\r'换行符 如果想读取转义符,必须定义为'\\' 多行转义后的换行符和空格都会被忽略 例子: a=1\ 2 读出后就是 a=12 |
ReaderInputStream |
Reader 作为InputStream 使用的实现。 |
StreamReader |
InputStream 读取器 |
StreamWriter |
OutputStream 写出器 |
StrInputStream |
基于字符串的InputStream
|
SyncInputStream |
同步流,可将包装的流同步为ByteArrayInputStream,以便持有内容并关闭原流
|
UTF8OutputStreamWriter |
This class is used to write a stream of chars as a stream of
bytes using the UTF8 encoding.
|
ValidateObjectInputStream |
带有类验证的对象流,用于避免反序列化漏洞
详细见:https://xz.aliyun.com/t/41/ |
WriterOutputStream |
通过一个 Writer和一个CharsetDecoder实现将字节数据输出为字符数据。
|
Copyright © 2025. All rights reserved.