Package ca.uhn.hl7v2.parser
Class EncodingDetector
java.lang.Object
ca.uhn.hl7v2.parser.EncodingDetector
Detects message encoding (ER7 / XML) without relying on any
external dependencies
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertEr7Encoded(String theMessage) Throws an exception if the message is not ER7 encodedstatic voidassertXmlEncoded(String theMessage) Throws an exception if the message is not XML encodedstatic booleanisEr7Encoded(String theMessage) Returns true if the message is ER7 (pipe-and-hat) encodedstatic booleanisXmlEncoded(String theMessage) Returns true if the message is XML encoded.
-
Method Details
-
assertEr7Encoded
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
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
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
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
-