public final class HL7Seps extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
static char |
COMPONENT_SEPARATOR_ESCAPE |
static HL7Seps |
DEFAULT
Separator using the default HL7 separator and escape characters.
|
static char |
DEFAULT_COMPONENT_SEPARATOR |
static char |
DEFAULT_ESCAPE_CHARACTER |
static char |
DEFAULT_FIELD_SEPARATOR |
static char |
DEFAULT_REPEAT_SEPARATOR |
static char |
DEFAULT_SUBCOMPONENT_SEPARATOR |
static char |
ESCAPE_CHARACTER_ESCAPE |
static char |
FIELD_SEPARATOR_ESCAPE |
static char |
HEX_DATA_ESCAPE |
static char |
REPEAT_SEPARATOR_ESCAPE |
static char |
SUBCOMPONENT_SEPARATOR_ESCAPE |
| Constructor and Description |
|---|
HL7Seps(char fieldSep,
char compSep,
char repSep)
Convenience constructor for when there is no sub-component separator and no escape character.
|
HL7Seps(char fieldSep,
char compSep,
char repSep,
char escChar)
Convenience constructor for when there is no sub-component separator.
|
HL7Seps(char fieldSep,
char compSep,
char repSep,
char escChar,
char subSep)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
String |
escape(String value)
Escape instances of any separator or escape character within the given string.
|
void |
escape(String value,
StringBuilder buf)
Escape instances of any separator or escape character within the given string, and add the result to the given buffer.
|
char |
getCompSep()
Get the component separator character.
|
char |
getEscChar()
Get the escape character.
|
char |
getFieldSep()
Get the field separator character.
|
char |
getRepSep()
Get the repeat separator character.
|
char |
getSubSep()
Get the sub-component separator character.
|
boolean |
hasEscapeCharacter()
Determine if there is an escape character defined.
|
int |
hashCode() |
boolean |
hasSubcomponentSeparator()
Determine if there is a sub-component character defined.
|
String |
toString()
Returns string representation as well-formed MSH.1 and MSH.2 fields.
|
String |
unescape(String value)
Parse the escaped string back into its unescaped form.
|
static void |
validate(char fieldSep,
char compSep,
char repSep,
char escChar,
char subSep)
Verify that the given combination of separator and escape characters is valid.
|
public static final char DEFAULT_FIELD_SEPARATOR
public static final char DEFAULT_COMPONENT_SEPARATOR
public static final char DEFAULT_REPEAT_SEPARATOR
public static final char DEFAULT_SUBCOMPONENT_SEPARATOR
public static final char DEFAULT_ESCAPE_CHARACTER
public static final char FIELD_SEPARATOR_ESCAPE
public static final char COMPONENT_SEPARATOR_ESCAPE
public static final char REPEAT_SEPARATOR_ESCAPE
public static final char ESCAPE_CHARACTER_ESCAPE
public static final char SUBCOMPONENT_SEPARATOR_ESCAPE
public static final char HEX_DATA_ESCAPE
public static final HL7Seps DEFAULT
public HL7Seps(char fieldSep,
char compSep,
char repSep,
char escChar,
char subSep)
throws HL7ContentException
The sub-component separator and escape characters are optional and may be equal to (char)0
to indicate not defined. However, if a sub-component separator is defined, then so must be an escape
character.
fieldSep - field separatorcompSep - component separatorrepSep - repetition separatorescChar - escape character, or (char)0 for nonesubSep - subcomponent separator, or (char)0 for noneHL7ContentException - if the characters are invalid according to validate(char, char, char, char, char)public HL7Seps(char fieldSep,
char compSep,
char repSep,
char escChar)
throws HL7ContentException
HL7Seps(fieldSep, compSep, repSep, escChar, (char)0)
fieldSep - field separatorcompSep - component separatorrepSep - repetition separatorescChar - escape character, or (char)0 for noneHL7ContentException - if the characters are invalid according to validate(char, char, char, char, char)public HL7Seps(char fieldSep,
char compSep,
char repSep)
throws HL7ContentException
HL7Seps(fieldSep, compSep, repSep, (char)0, (char)0)
fieldSep - field separatorcompSep - component separatorrepSep - repetition separatorHL7ContentException - if the characters are invalid according to validate(char, char, char, char, char)public char getFieldSep()
public char getCompSep()
public char getRepSep()
public char getEscChar()
(char)0 for nonehasEscapeCharacter()public char getSubSep()
(char)0 for nonehasSubcomponentSeparator()public String escape(String value)
If some character needs to be escaped but there is no escape character defined, the character is silently elided.
value - the String to escapepublic void escape(String value, StringBuilder buf)
If some character needs to be escaped but there is no escape character defined, the character is silently elided.
value - the String to escapebuf - buffer to append topublic boolean hasSubcomponentSeparator()
public boolean hasEscapeCharacter()
public String unescape(String value)
The string must have been previously escaped using the same escape character as is defined for this instance.
If no escape character is defined for this instance, the unaltered value is returned.
Any "custom" or invalid escapes are silently removed.
An unclosed escape is returned unaltered.
value - escaped string valuepublic String toString()
public static void validate(char fieldSep,
char compSep,
char repSep,
char escChar,
char subSep)
throws HL7ContentException
This method performs the following checks:
fieldSep - field separatorcompSep - component separatorrepSep - repetition separatorescChar - escape character, or (char)0 for nonesubSep - subcomponent separator, or (char)0 for noneHL7ContentException - if the characters are invalidCopyright © 2018. All rights reserved.