/** * Formats a Message object into an HL7 message string using the given encoding. * * @throws HL7Exception if the data fields in the message do not permit encoding (e.g. required * fields are null) * @throws EncodingNotSupportedException if the requested encoding is not supported by this * parser. */ protected String doEncode(Message source, String encoding) throws HL7Exception, EncodingNotSupportedException { String ret = null; if (encoding == null) encoding = ""; // prevent null pointer exception if (encoding.equalsIgnoreCase("VB")) { ret = pipeParser.doEncode(source); } else if (encoding.equalsIgnoreCase("XML")) { ret = xmlParser.doEncode(source); } else { throw new EncodingNotSupportedException("The encoding " + encoding + " is not supported by " + this.getClass().getName()); } return ret; }
/** * Formats a Message object into an HL7 message string using the given encoding. * * @throws HL7Exception if the data fields in the message do not permit encoding (e.g. required * fields are null) * @throws EncodingNotSupportedException if the requested encoding is not supported by this * parser. */ protected String doEncode(Message source, String encoding) throws HL7Exception, EncodingNotSupportedException { String ret = null; if (encoding == null) encoding = ""; // prevent null pointer exception if (encoding.equalsIgnoreCase("VB")) { ret = pipeParser.doEncode(source); } else if (encoding.equalsIgnoreCase("XML")) { ret = xmlParser.doEncode(source); } else { throw new EncodingNotSupportedException("The encoding " + encoding + " is not supported by " + this.getClass().getName()); } return ret; }