Class EncodingDetector
java.lang.Object
dev.jcputney.elearning.parser.util.EncodingDetector
Utility class for detecting character encoding of XML files. Supports BOM (Byte Order Mark)
detection and XML declaration parsing.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordWrapper class that holds an input stream and its detected encoding. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondetectEncoding(InputStream inputStream) Detects the encoding of an XML input stream.
-
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
-