public class BOMInputStream
extends java.io.InputStream
getCharset()方法调用后会得到BOM头的编码,且会去除BOM头
String enc = "UTF-8"; // or NULL to use systemdefault
FileInputStream fis = new FileInputStream(file);
BOMInputStream uin = new BOMInputStream(fis, enc);
enc = uin.getCharset(); // check and skip possible BOM bytes
| 构造器和说明 |
|---|
BOMInputStream(java.io.InputStream in) |
BOMInputStream(java.io.InputStream in,
java.lang.String defaultCharset) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close() |
java.lang.String |
getCharset() |
java.lang.String |
getDefaultCharset() |
protected void |
init()
Read-ahead four bytes and check for BOM marks.
|
int |
read() |
public BOMInputStream(java.io.InputStream in)
public BOMInputStream(java.io.InputStream in,
java.lang.String defaultCharset)
public java.lang.String getDefaultCharset()
public java.lang.String getCharset()
public void close()
throws java.io.IOException
close 在接口中 java.io.Closeableclose 在接口中 java.lang.AutoCloseableclose 在类中 java.io.InputStreamjava.io.IOExceptionpublic int read()
throws java.io.IOException
read 在类中 java.io.InputStreamjava.io.IOExceptionprotected void init()
throws java.io.IOException
java.io.IOException - 读取引起的异常Copyright © 2018. All rights reserved.