org.eclipse.ohf.ihe.common.hl7v2.format
Class HL7V2MessageUtils

java.lang.Object
  extended by org.eclipse.ohf.ihe.common.hl7v2.format.HL7V2MessageUtils

public class HL7V2MessageUtils
extends java.lang.Object

Utilities class to aid in the contruction of HL7 V2 message strings. We anticipate this functionality (some day) to be absorbed into the HL7v2 stack provided in org.eclipse.ohf.hl7v2

Author:
Sarah Knoop

Constructor Summary
HL7V2MessageUtils()
           
 
Method Summary
static java.util.ArrayList parse(java.lang.String msg, char delimiter)
          Parses the given message using the given delimiter into a String array in which each element is reserved for a single component of the message.
static void trimDelimiters(java.lang.StringBuffer msg, char delimiter)
          Trims trailing delimiters from the message string
static void trimDelimiters(java.lang.StringBuffer msg, char delimiter, char subdelimiter)
          Trims trailing delimiters and sub delimiters from the message string
static void trimDelimiters(java.lang.StringBuffer msg, char subcomponent, char component, char field, char repetition)
          Trims trailing delimiters from the segment message string
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HL7V2MessageUtils

public HL7V2MessageUtils()
Method Detail

trimDelimiters

public static void trimDelimiters(java.lang.StringBuffer msg,
                                  char delimiter)
Trims trailing delimiters from the message string

Parameters:
msg -
delimiter -

trimDelimiters

public static void trimDelimiters(java.lang.StringBuffer msg,
                                  char delimiter,
                                  char subdelimiter)
Trims trailing delimiters and sub delimiters from the message string

Parameters:
msg -
delimiter -
subdelimiter -

trimDelimiters

public static void trimDelimiters(java.lang.StringBuffer msg,
                                  char subcomponent,
                                  char component,
                                  char field,
                                  char repetition)
Trims trailing delimiters from the segment message string

Parameters:
msg -
subcomponent -
component -
field -
repetition -

parse

public static java.util.ArrayList parse(java.lang.String msg,
                                        char delimiter)
Parses the given message using the given delimiter into a String array in which each element is reserved for a single component of the message. An element in the string array will be null if a component is not present.

Parameters:
msg - the message string
delimiter - the HL7 delimiter of the message
Returns:
the ordered ArrayList of individual components and subcomponents