Class EncodingDetector

java.lang.Object
ca.uhn.hl7v2.parser.EncodingDetector

public final class EncodingDetector extends Object
Detects message encoding (ER7 / XML) without relying on any external dependencies
  • Method Details

    • assertEr7Encoded

      public static void assertEr7Encoded(String theMessage)
      Throws an exception if the message is not ER7 encoded
      Parameters:
      theMessage - message to be examined
      Throws:
      RuntimeException - if message is not ER7-encoded
    • isEr7Encoded

      public static boolean isEr7Encoded(String theMessage)
      Returns true if the message is ER7 (pipe-and-hat) encoded
      Parameters:
      theMessage - message to be examined
      Returns:
      true if message is ER7-encoded
    • assertXmlEncoded

      public static void assertXmlEncoded(String theMessage)
      Throws an exception if the message is not XML encoded
      Parameters:
      theMessage - message to be examined
      Throws:
      RuntimeException - if message is not XML-encoded
    • isXmlEncoded

      public static boolean isXmlEncoded(String theMessage)
      Returns true if the message is XML encoded. Note that this message does not perform a very robust check, and does not validate for well-formedness. It is only intended to perform a simple check for XML vs. ER7 messages.
      Parameters:
      theMessage - message to be examined
      Returns:
      true if message is XML-encoded