com.reverseXSL.message
Class Header

java.lang.Object
  extended by com.reverseXSL.message.Header

public abstract class Header
extends java.lang.Object

NOTE: The support for EDI headers is not yet integrated into the current version of the tool set, but a few static utility procedures are already used elsewhere. Headers will become syntax-independent address handling and routing vehicles in a future release.


Constructor Summary
Header()
           
 
Method Summary
static java.lang.String extractReference(java.lang.CharSequence s, java.lang.String regex)
          The procedure concatenates all captured info pieces (by one or several capturing groups in the regular expression) from the first match found in the char sequence passed as argument, using MULTILINE and DOTALL modes.
static java.lang.String extractReference(java.lang.CharSequence s, java.lang.String regex, int upTo)
          Variant of extractReference(CharSequence, String) that limits here the pattern lookup to the region from the first to 'upTo' characters.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Header

public Header()
Method Detail

extractReference

public static java.lang.String extractReference(java.lang.CharSequence s,
                                                java.lang.String regex)
The procedure concatenates all captured info pieces (by one or several capturing groups in the regular expression) from the first match found in the char sequence passed as argument, using MULTILINE and DOTALL modes.

This procedure is inspired from Parser.extractCompositeValue(StringBuffer, Pattern) but with two differences: It does not loop on matcher.find() but calls it only once, and--second--it works in MULTILINE mode.
MULTILINE indicates that the '^' and '$' can match not only the start and end of the entire char sequence, but also any intermediate line terminator (delimited by LF, CRLF, CR alone, or the Unicode next-line, line-separator, and paragraph marks). Note that matching characters of a CRLF sequence requires for instance the pattern "$..^".
DOTALL indicates that the '.' matches any character including line terminator characters.

Parameters:
s - the char sequence from which to extract the reference: a CharBuffer, String, or StringBuffer
regex - the regex pattern to match; only the first match is considered.
Returns:
the catenation on all matched capturing groups (one level deep only, sub-capturing groups are ignored) or an exception string whenever the input sequence is NULL or the regex is corrupt. If there are no matches, the empty string is returned.

extractReference

public static java.lang.String extractReference(java.lang.CharSequence s,
                                                java.lang.String regex,
                                                int upTo)
Variant of extractReference(CharSequence, String) that limits here the pattern lookup to the region from the first to 'upTo' characters.

Parameters:
s - the char sequence from which to extract the reference: a CharBuffer, String, or StringBuffer
regex - the regex pattern to match; only the first match is considered.
upTo - is used to delimit the matching region, so that the entire message is surely not parsed
Returns:
the catenation on all matched capturing groups (one level deep only, sub-capturing groups are ignored) or an exception string whenever the input sequence is NULL or the regex is corrupt. If there are no matches, the empty string is returned.