Package org.aoju.bus.core.io.stream
Class BOMReader
java.lang.Object
java.io.Reader
org.aoju.bus.core.io.stream.BOMReader
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
读取带BOM头的流内容的Reader,如果非bom的流或无法识别的编码,则默认UTF-8
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
FileInputStream fis = new FileInputStream(file);
BOMReader uin = new BOMReader(fis);
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, read, ready, reset, skip, transferTo
-
Constructor Details
-
BOMReader
构造- Parameters:
in- 流
-
-
Method Details
-
read
- Specified by:
readin classReader- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException
-