ch.ethz.mxquery.util
Class UnicodeInputStream
java.lang.Object
java.io.InputStream
ch.ethz.mxquery.util.UnicodeInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class UnicodeInputStream
- extends java.io.InputStream
This inputstream will recognize unicode BOM marks
and will skip bytes if getEncoding() method is called
before any of the read(...) methods.
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);
Methods inherited from class java.io.InputStream |
available, mark, markSupported, read, read, reset, skip |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getDefaultEncoding
public java.lang.String getDefaultEncoding()
getEncoding
public java.lang.String getEncoding()
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Overrides:
close
in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read()
throws java.io.IOException
- Specified by:
read
in class java.io.InputStream
- Throws:
java.io.IOException
MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich