org.urhl7.spark
Class SparkFileReader

java.lang.Object
  extended by org.urhl7.spark.SparkFileReader

public class SparkFileReader
extends Object

A simple HL7 File reader that will use an event driven model that fires on each parsing of a message in the file.


Field Summary
static String DELIMITER_DEFAULT
          The default delimiter between messages.
 
Constructor Summary
SparkFileReader(File inputFile)
          Creates a new SparkFileReader pointing at a specific file with no listener.
SparkFileReader(File inputFile, HL7MessageListener listener)
          Creates a new SparkFileReader pointing at a specific file with a specified listener.
SparkFileReader(File inputFile, HL7MessageListener listener, String delimiter)
          Create a new SparkFileReader pointing a specific file, with a listener, and a specified delimiter.
SparkFileReader(File inputFile, String delimiter)
          Creates a new SparkFileReader pointing at a specific file with no listener using the specified delimiter.
 
Method Summary
 String getDelimiter()
          Returns the delimiter that is being searched for between messages in the file.
 int getInternalBufferSize()
          Gets the size of the internal buffer being used.
 HL7MessageListener getListener()
          Returned the HL7MessageListener that is being triggered for this SparkFileReader.
 void parse()
          Begins pasring the messages in the file specified.
 void setDelimiter(String delimiter)
          Sets the delimiter to look for between messages in the file.
 void setInternalBufferSize(int internalBufferSize)
          Sets the size of the internal buffer being used.
 void setListener(HL7MessageListener listener)
          Sets the listener to use for the handling of messages as they come in to the SparkFileReader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELIMITER_DEFAULT

public static final String DELIMITER_DEFAULT
The default delimiter between messages. The default value is "\r\n"

See Also:
Constant Field Values
Constructor Detail

SparkFileReader

public SparkFileReader(File inputFile)
Creates a new SparkFileReader pointing at a specific file with no listener.

Parameters:
inputFile - The file to read in

SparkFileReader

public SparkFileReader(File inputFile,
                       HL7MessageListener listener)
Creates a new SparkFileReader pointing at a specific file with a specified listener.

Parameters:
inputFile - the file to read in
listener - the listener to use

SparkFileReader

public SparkFileReader(File inputFile,
                       String delimiter)
Creates a new SparkFileReader pointing at a specific file with no listener using the specified delimiter.

Parameters:
inputFile - the file to read in
delimiter - the delimiter between messages

SparkFileReader

public SparkFileReader(File inputFile,
                       HL7MessageListener listener,
                       String delimiter)
Create a new SparkFileReader pointing a specific file, with a listener, and a specified delimiter.

Parameters:
inputFile -
listener -
delimiter -
Method Detail

getDelimiter

public String getDelimiter()
Returns the delimiter that is being searched for between messages in the file.

Returns:
the delimiter

setDelimiter

public void setDelimiter(String delimiter)
Sets the delimiter to look for between messages in the file.

Parameters:
delimiter - the delimiter to set

getListener

public HL7MessageListener getListener()
Returned the HL7MessageListener that is being triggered for this SparkFileReader.

Returns:
the listener

setListener

public void setListener(HL7MessageListener listener)
Sets the listener to use for the handling of messages as they come in to the SparkFileReader.

Parameters:
listener - the listener to set

parse

public void parse()
           throws IOException
Begins pasring the messages in the file specified. This may throw an IOException and must be handled. The parse function reads in the file, when it finds a delimiter will attempt to parse the message. This message is then sent to the listener specified.

Throws:
IOException

getInternalBufferSize

public int getInternalBufferSize()
Gets the size of the internal buffer being used.

Returns:
the INTERNAL_BUFFER_SIZE

setInternalBufferSize

public void setInternalBufferSize(int internalBufferSize)
Sets the size of the internal buffer being used.

Parameters:
internalBufferSize - the INTERNAL_BUFFER_SIZE to set