Class IOUtil.BomAwareInputStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable
    Enclosing class:
    IOUtil

    public static class IOUtil.BomAwareInputStream
    extends FilterInputStream

    Input stream that skips an optional byte order mark at the beginning of the stream. Whether the stream had a byte order mark (encoded in either UTF-8, UTF-16LE or UTF-16BE) can be checked with hasBom(). The corresponding charset can be retrieved with getBomCharsetName().

    If the stream didn't had a BOM, then no bytes are skipped.