public class DataProcessor extends WithDiagnostics implements scala.Serializable
| Constructor and Description |
|---|
DataProcessor(org.apache.daffodil.processors.DataProcessor dp) |
| Modifier and Type | Method and Description |
|---|---|
DaffodilUnparseContentHandler |
newContentHandlerInstance(java.nio.channels.WritableByteChannel output)
Obtain a new
DaffodilUnparseContentHandler from the current DataProcessor. |
DaffodilParseXMLReader |
newXMLReaderInstance()
Obtain a new
DaffodilParseXMLReader from the current DataProcessor. |
ParseResult |
parse(InputSourceDataInputStream input,
InfosetOutputter output)
Parse input data from an InputSourceDataInputStream and output the infoset to an InfosetOutputter
|
ParseResult |
parse(java.nio.channels.ReadableByteChannel input)
Deprecated.
Use parse(InputSourceDataInputStream, InfosetOutputter) to parse the data and get the infoset representation from the InfosetOutputter instead of ParseResult#result(). Since 2.2.0.
|
ParseResult |
parse(java.nio.channels.ReadableByteChannel input,
InfosetOutputter output)
Deprecated.
Use parse(InputSourceDataInputStream, InfosetOutputter) to parse the data and get the infoset representation from the InfosetOutputter instead of ParseResult#result(). Since 2.2.0.
|
ParseResult |
parse(java.nio.channels.ReadableByteChannel input,
InfosetOutputter output,
long lengthLimitInBits)
Deprecated.
Use parse(InputSourceDataInputStream, InfosetOutputter) to parse the data and get the infoset representation from the InfosetOutputter instead of ParseResult#result(). Since 2.2.0.
|
ParseResult |
parse(java.nio.channels.ReadableByteChannel input,
long lengthLimitInBits)
Deprecated.
Use parse(InputSourceDataInputStream, InfosetOutputter) to parse the data and get the infoset representation from the InfosetOutputter instead of ParseResult#result(). Since 2.2.0.
|
void |
save(java.nio.channels.WritableByteChannel output)
Save the DataProcessor
|
void |
setDebugger(DebuggerRunner dr)
Deprecated.
Use withDebuggerRunner. Since 2.6.0.
|
void |
setDebugging(boolean flag)
Deprecated.
Use withDebugging. Since 2.6.0.
|
void |
setExternalVariables(java.io.File extVars)
Deprecated.
Use withExternalVariables. Since 2.6.0.
|
void |
setExternalVariables(scala.collection.immutable.Map<java.lang.String,java.lang.String> extVars)
Deprecated.
Use withExternalVariables. Since 2.6.0.
|
void |
setValidationMode(ValidationMode mode)
Deprecated.
Use withValidationMode. Since 2.6.0.
|
UnparseResult |
unparse(InfosetInputter input,
java.nio.channels.WritableByteChannel output)
Unparse an InfosetInputter
|
UnparseResult |
unparse(java.nio.channels.WritableByteChannel output,
org.jdom2.Document infoset)
Deprecated.
Use unparse(InfosetInputter, WritableByteChannel). Since 2.0.0.
|
DataProcessor |
withDebugger(org.apache.daffodil.debugger.Debugger dbg)
Obtain a new
DataProcessor with a specified debugger. |
DataProcessor |
withDebuggerRunner(DebuggerRunner dr)
Obtain a new
DataProcessor with a specified debugger runner. |
DataProcessor |
withDebugging(boolean flag)
Obtain a new
DataProcessor instance with debugging enabled or disabled. |
DataProcessor |
withExternalVariables(java.util.AbstractMap<java.lang.String,java.lang.String> extVars)
Obtain a new
DataProcessor with multiple DFDL variables set. |
DataProcessor |
withExternalVariables(java.io.File extVars)
Obtain a new
DataProcessor with external variables read from a Daffodil configuration file |
DataProcessor |
withExternalVariables(scala.collection.immutable.Map<java.lang.String,java.lang.String> extVars)
Deprecated.
Use withExternalVariables that accepts a Java AbstractMap. Since 3.0.
|
DataProcessor |
withValidationMode(ValidationMode mode)
Obtain a new
DataProcessor having a specific validation mode |
DataProcessor |
withValidator(org.apache.daffodil.api.Validator validator)
Obtain a new
DataProcessor having a specific validator |
canProceed, getDiagnostics, isErrorpublic DataProcessor(org.apache.daffodil.processors.DataProcessor dp)
public DaffodilUnparseContentHandler newContentHandlerInstance(java.nio.channels.WritableByteChannel output)
DaffodilUnparseContentHandler from the current DataProcessor.output - (undocumented)public DaffodilParseXMLReader newXMLReaderInstance()
DaffodilParseXMLReader from the current DataProcessor.public ParseResult parse(java.nio.channels.ReadableByteChannel input, long lengthLimitInBits)
input - data to be parsedlengthLimitInBits - the length of the input data in bits, or -1 if no limitpublic ParseResult parse(java.nio.channels.ReadableByteChannel input)
input - data to be parsedpublic ParseResult parse(java.nio.channels.ReadableByteChannel input, InfosetOutputter output, long lengthLimitInBits)
input - data to be parsedoutput - the InfosetOutputter that will be used to output the infosetlengthLimitInBits - the length of the input data in bits, or -1 if no limitpublic ParseResult parse(java.nio.channels.ReadableByteChannel input, InfosetOutputter output)
Use this when you don't know how big the data is.
input - data to be parsedoutput - the InfosetOutputter that will be used to output the infosetpublic ParseResult parse(InputSourceDataInputStream input, InfosetOutputter output)
input - data to be parsedoutput - the InfosetOutputter that will be used to output the infosetpublic void save(java.nio.channels.WritableByteChannel output)
The resulting output can be reloaded by Compiler.reload(java.nio.channels.ReadableByteChannel).
Note that external variable bindings are not saved, and will not be restored upon reloading.
output - the byte channel to write the DataProcessor topublic void setDebugger(DebuggerRunner dr)
dr - debugger runnerpublic void setDebugging(boolean flag)
Before enabling, withDebugger(org.apache.daffodil.debugger.Debugger) or withDebuggerRunner(DebuggerRunner) must be
called with a non-null debugger.
flag - true to enable debugging, false to disabledpublic void setExternalVariables(java.io.File extVars)
throws ExternalVariableException
extVars - file to read DFDL variables from.ExternalVariableException - if an error occurs while setting an external variablepublic void setExternalVariables(scala.collection.immutable.Map<java.lang.String,java.lang.String> extVars)
throws ExternalVariableException
extVars - a map of key/value pairs, where the key is the variable
name, and the value is the value of the variable. The key
may be preceded by a string of the form "{namespace}" to
define a namespace for the variable. If preceded with "{}",
then no namespace is used. If not preceded by anything,
then Daffodil will figure out the namespace.ExternalVariableException - if an error occurs while setting an external variablepublic void setValidationMode(ValidationMode mode) throws InvalidUsageException
mode - mode to control validationInvalidUsageException - if mode is not a valid ValidateMode valuepublic UnparseResult unparse(InfosetInputter input, java.nio.channels.WritableByteChannel output)
input - the infoset inputter to use for unparsingoutput - the byte channel to write the data topublic UnparseResult unparse(java.nio.channels.WritableByteChannel output, org.jdom2.Document infoset)
output - the byte channel to write the data toinfoset - the infoset to unparse, as a jdom event cursorpublic DataProcessor withDebugger(org.apache.daffodil.debugger.Debugger dbg)
DataProcessor with a specified debugger.
dbg - debuggerpublic DataProcessor withDebuggerRunner(DebuggerRunner dr)
DataProcessor with a specified debugger runner.
dr - debugger runnerpublic DataProcessor withDebugging(boolean flag)
DataProcessor instance with debugging enabled or disabled.
Before enabling, withDebugger(Debugger) or withDebuggerRunner(DebuggerRunner)
must be called to obtain a DataProcessor with a non-null debugger.
flag - true to enable debugging, false to disabledpublic DataProcessor withExternalVariables(java.io.File extVars) throws ExternalVariableException
DataProcessor with external variables read from a Daffodil configuration file
extVars - file to read DFDL variables from.ExternalVariableException - if an error occurs while setting an external variablepublic DataProcessor withExternalVariables(scala.collection.immutable.Map<java.lang.String,java.lang.String> extVars) throws ExternalVariableException
DataProcessor with multiple DFDL variables set.
extVars - a map of key/value pairs, where the key is the variable
name, and the value is the value of the variable. The key
may be preceded by a string of the form "{namespace}" to
define a namespace for the variable. If preceded with "{}",
then no namespace is used. If not preceded by anything,
then Daffodil will figure out the namespace.ExternalVariableException - if an error occurs while setting an external variablepublic DataProcessor withExternalVariables(java.util.AbstractMap<java.lang.String,java.lang.String> extVars) throws ExternalVariableException
DataProcessor with multiple DFDL variables set.
extVars - a map of key/value pairs, where the key is the variable
name, and the value is the value of the variable. The key
may be preceded by a string of the form "{namespace}" to
define a namespace for the variable. If preceded with "{}",
then no namespace is used. If not preceded by anything,
then Daffodil will figure out the namespace.ExternalVariableException - if an error occurs while setting an external variablepublic DataProcessor withValidationMode(ValidationMode mode) throws InvalidUsageException
DataProcessor having a specific validation mode
mode - mode to control validationInvalidUsageException - if mode is not a valid ValidateMode valuepublic DataProcessor withValidator(org.apache.daffodil.api.Validator validator)
DataProcessor having a specific validatorvalidator - validator instance