Class BomAwareInputStream

All Implemented Interfaces:
Closeable, AutoCloseable

public class BomAwareInputStream extends PushbackInputStream
Read up to 4 bytes to determine the BOM. Extra bytes, of if no BOM is found are pushed back to the input stream. If no BOM is found, the detectedCharsetName is null.
  • Constructor Details

  • Method Details

    • getDetectedCharset

      public Charset getDetectedCharset()
      Returns detected charset name. Null if no BOM header was found.
      Returns:
      charset name - one of UTF-8, UTF-16BE, UTF-32LE, UTF-16LE, UTF-32BE or null if no BOM detected
    • init

      protected void init() throws IOException
      Throws:
      IOException