Class EncodingDetector

java.lang.Object
dev.jcputney.elearning.parser.util.EncodingDetector

public final class EncodingDetector extends Object
Utility class for detecting character encoding of XML files. Supports BOM (Byte Order Mark) detection and XML declaration parsing.
  • Constructor Details

    • EncodingDetector

      public EncodingDetector()
  • Method Details

    • detectEncoding

      public static EncodingDetector.EncodingAwareInputStream detectEncoding(InputStream inputStream) throws IOException
      Detects the encoding of an XML input stream. First checks for BOM, then falls back to XML declaration parsing.
      Parameters:
      inputStream - The input stream to analyze
      Returns:
      A wrapped input stream with detected encoding
      Throws:
      IOException - if an I/O error occurs