Class XMLCharsetDeterminator

java.lang.Object
com.helger.xml.serialize.read.XMLCharsetDeterminator

@Immutable public final class XMLCharsetDeterminator extends Object
XML charset determinator based on a byte array.
Since:
9.0.0
Author:
Philip Helger
  • Field Details

    • FALLBACK_CHARSET

      public static final Charset FALLBACK_CHARSET
  • Method Details

    • getAllSupportedCharsets

      @Nonnull @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsSet<Charset> getAllSupportedCharsets()
      Returns:
      A mutable Set with all charsets that can be used for the charset determination. Never null.
    • determineXMLCharset

      @Nullable public static Charset determineXMLCharset(@Nonnull byte[] aBytes)
      Determine the XML charset
      Parameters:
      aBytes - XML byte representation
      Returns:
      null if no charset was found. In that case you might wanna try UTF-8 as the fallback.