Class UnicodeInputStream

java.lang.Object
java.io.InputStream
de.hybris.bootstrap.xml.UnicodeInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class UnicodeInputStream extends InputStream
This inputstream will recognize unicode BOM marks and will skip bytes if getEncoding() method is called before any of the read(...) methods. Invoking read methods without first calling getEncoding will not skip BOM mark.

Usage pattern: String enc = "ISO-8859-1"; // or put NULL to use systemdefault FileInputStream fis = new FileInputStream(file); UnicodeInputStream uin = new UnicodeInputStream(fis, enc); enc = uin.getEncoding(); // check for BOM mark and skip bytes InputStreamReader in; if (enc == null) in = new InputStreamReader(uin); else in = new InputStreamReader(uin, enc);

  • Constructor Details

  • Method Details