com.berryworks.edireader
Class EDIReaderFactory

java.lang.Object
  extended by com.berryworks.edireader.EDIReaderFactory

public class EDIReaderFactory
extends java.lang.Object

Creates a subclass of EDIReader appropriate for parsing a particular EDI interchange. This class has just enough knowledge of the supported standards make a decision based on observation of the first several characters of data. This decision does not imply that data in well-formed with regard to the chosen standard, but merely that we know which actual parser to use.


Constructor Summary
EDIReaderFactory()
           
 
Method Summary
static EDIReader createEDIReader(org.xml.sax.InputSource source)
          Equivalent to createEDIReader(source, debugging=false)
static EDIReader createEDIReader(org.xml.sax.InputSource source, boolean debug)
          Factory method to create an instance of a subclass of EDIReader based on examination of the first few characters of data.
static EDIReader createEDIReader(org.xml.sax.InputSource source, char[] preRead)
          Factory method to create an instance of a subclass of EDIReader based on examination of the first few characters of data.
static EDIReader createEDIReader(org.xml.sax.InputSource source, char[] preRead, boolean debug)
          Factory method to create an instance of a subclass of EDIReader based on examination of the first few characters of data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EDIReaderFactory

public EDIReaderFactory()
Method Detail

createEDIReader

public static EDIReader createEDIReader(org.xml.sax.InputSource source)
                                 throws EDISyntaxException,
                                        java.io.IOException
Equivalent to createEDIReader(source, debugging=false)

Parameters:
source - EDI input
Returns:
EDIReader
Throws:
java.io.IOException - if problem reading EDI input
EDISyntaxException - if invalid EDI is detected

createEDIReader

public static EDIReader createEDIReader(org.xml.sax.InputSource source,
                                        boolean debug)
                                 throws EDISyntaxException,
                                        java.io.IOException
Factory method to create an instance of a subclass of EDIReader based on examination of the first few characters of data.

Parameters:
source - EDI source
debug - true to turn debug on, false to turn it off
Returns:
created EDIReader instance
Throws:
java.io.IOException - for problem reading EDI data
EDISyntaxException - if invalid EDI is detected

createEDIReader

public static EDIReader createEDIReader(org.xml.sax.InputSource source,
                                        char[] preRead)
                                 throws EDISyntaxException,
                                        java.io.IOException
Factory method to create an instance of a subclass of EDIReader based on examination of the first few characters of data. The second argument allows for an array of chars to be treated as data that appears before the next char of input from source. This can be useful when the source was used earlier and some buffered and unused chars were left over. In other words, the second argument provides for a kind of "pushback" feature for the data source.

Parameters:
source - EDI source
preRead - chars of EDI input data to be used before reading from the source
Returns:
created EDIReader instance
Throws:
java.io.IOException - for problem reading EDI data
EDISyntaxException - if invalid EDI is detected

createEDIReader

public static EDIReader createEDIReader(org.xml.sax.InputSource source,
                                        char[] preRead,
                                        boolean debug)
                                 throws EDISyntaxException,
                                        java.io.IOException
Factory method to create an instance of a subclass of EDIReader based on examination of the first few characters of data.

Parameters:
source - EDI source
preRead - chars of EDI input data to be used before reading from the source
debug - true to turn debug on, false to turn it off
Returns:
created EDIReader instance
Throws:
java.io.IOException - for problem reading EDI data
EDISyntaxException - if invalid EDI is detected