public class UnicodeInputStream extends InputStream
Usage pattern: String enc = "ISO-8859-1"; // or NULL to use systemdefault FileInputStream fis = new FileInputStream(file); UnicodeInputStream uin = new UnicodeInputStream(fis, enc); enc = uin.getEncoding(); // check and skip possible BOM bytes InputStreamReader in; if (enc == null) in = new InputStreamReader(uin); else in = new InputStreamReader(uin, enc);
限定符和类型 | 字段和说明 |
---|---|
static int |
BOM_SIZE |
构造器和说明 |
---|
UnicodeInputStream(InputStream in,
String defaultEncoding) |
限定符和类型 | 方法和说明 |
---|---|
void |
close() |
String |
getDefaultEncoding() |
String |
getEncoding() |
protected void |
init()
Read-ahead four bytes and check for BOM marks.
|
int |
read() |
available, mark, markSupported, read, read, reset, skip
public static final int BOM_SIZE
public UnicodeInputStream(InputStream in, String defaultEncoding)
public String getDefaultEncoding()
public String getEncoding()
protected void init() throws IOException
IOException
public void close() throws IOException
close
在接口中 Closeable
close
在接口中 AutoCloseable
close
在类中 InputStream
IOException
public int read() throws IOException
read
在类中 InputStream
IOException