ca.uhn.hl7v2.llp
Class MinLLPReader

java.lang.Object
  extended by ca.uhn.hl7v2.llp.MinLLPReader
All Implemented Interfaces:
HL7Reader

public class MinLLPReader
extends Object
implements HL7Reader

Title: HL7Reader Description: A buffered reader specifically designed for use in reading HL7 ASCII strings. This class assumes that the minimal lower layer protocol is being used. Copyright: Copyright (c) 2001 Company: University Health Network

Author:
Damian Horton (damian.horton@uhn.on.ca); mods by Bryan Tripp

Field Summary
static String CHARSET_KEY
           System property: If a value is set for this property, the value is interpreted as a character set, and this characterset is used.
static char END_MESSAGE
          Character indicating the termination of an HL7 message
static char LAST_CHARACTER
          The final character of a message: a carriage return.
static char START_MESSAGE
          character indicating the start of an HL7 message
 
Constructor Summary
MinLLPReader()
          Creates a MinLLPReader with no setup - setInputStream must be set later.
MinLLPReader(InputStream in)
          Creates a MinLLPReader which reads from the given InputStream.
MinLLPReader(InputStream in, Charset theCharset)
          Creates a MinLLPReader which reads from the given InputStream.
 
Method Summary
 void close()
          Closes the underlying BufferedReader.
 String getMessage()
          Reads an HL7 encoded message from this Reader's InputStream.
static void main(String[] args)
          Test driver for the program.
 void setInputStream(InputStream in)
          Sets the InputStream from which to read messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHARSET_KEY

public static final String CHARSET_KEY

System property: If a value is set for this property, the value is interpreted as a character set, and this characterset is used. A possible example is "UTF-8" if you are receiving messages from a system that transmits in UTF-8.

If the system property is set to a value of "default" (in other words, a string containing only the word default), then the platform default is used.

If the system property is not set, US-ASCII encoding is used.

See Also:
Constant Field Values

END_MESSAGE

public static final char END_MESSAGE
Character indicating the termination of an HL7 message

See Also:
Constant Field Values

START_MESSAGE

public static final char START_MESSAGE
character indicating the start of an HL7 message

See Also:
Constant Field Values

LAST_CHARACTER

public static final char LAST_CHARACTER
The final character of a message: a carriage return. NB: This is per the minimal lower layer protocol.

See Also:
Constant Field Values
Constructor Detail

MinLLPReader

public MinLLPReader()
Creates a MinLLPReader with no setup - setInputStream must be set later.


MinLLPReader

public MinLLPReader(InputStream in)
             throws IOException
Creates a MinLLPReader which reads from the given InputStream. The stream is assumed to be an ASCII bit stream.

Throws:
IOException

MinLLPReader

public MinLLPReader(InputStream in,
                    Charset theCharset)
             throws IOException
Creates a MinLLPReader which reads from the given InputStream. The stream is assumed to be an ASCII bit stream.

Throws:
IOException
Method Detail

setInputStream

public void setInputStream(InputStream in)
                    throws IOException
Sets the InputStream from which to read messages. The InputStream must be set before any calls to getMessage().

Specified by:
setInputStream in interface HL7Reader
Throws:
IOException

getMessage

public String getMessage()
                  throws LLPException,
                         IOException
Reads an HL7 encoded message from this Reader's InputStream.

Specified by:
getMessage in interface HL7Reader
Returns:
The message, in string format, without the lower level protocol delimeters. Returns null if a -1 is received on the initial read.
Throws:
LLPException
IOException

main

public static void main(String[] args)
Test driver for the program. Bounces a message off of an echo socket, and ascertaines whether or not this class works.


close

public void close()
           throws IOException
Closes the underlying BufferedReader.

Specified by:
close in interface HL7Reader
Throws:
IOException


Copyright © 2001-2012 University Health Network. All Rights Reserved.