public class RecStreamCSVOutputHandler extends Object implements IOutputHandler, IStreaming
IStreaming.IStreamCloser, IStreaming.IStreamProcessor<T>
Modifier and Type | Field and Description |
---|---|
static char |
DELIMETER_DEFAULT |
static char |
ESCAPE_CHAR_DEFAULT |
static String |
NEW_LINE_SEPARATOR_DEFAULT |
static char |
VALUE_SEPARATOR_DEFAULT |
Constructor and Description |
---|
RecStreamCSVOutputHandler(boolean allowMultipleValuesPerAttribute,
String entity,
String[] attributes,
Appendable output,
boolean includeId,
int initId,
boolean printHeader,
RecStreamOutputHandler.IFilter<String> valFilter,
RecStreamOutputHandler.IFilter<Record> recFilter) |
RecStreamCSVOutputHandler(String wrapperId,
boolean allowMultipleValuesPerAttribute,
String entity,
String[] attributes,
Appendable output,
boolean includeId,
int initId,
boolean printHeader,
RecStreamOutputHandler.IFilter<String> valFilter,
RecStreamOutputHandler.IFilter<Record> recFilter) |
RecStreamCSVOutputHandler(String wrapperId,
boolean allowMultipleValuesPerAttribute,
String entity,
String[] attributes,
Appendable output,
boolean includeId,
int initId,
boolean printHeader,
RecStreamOutputHandler.IFilter<String> valFilter,
RecStreamOutputHandler.IFilter<Record> recFilter,
char valueSeparator,
char escapeChar,
org.apache.commons.csv.CSVFormat csvFileFormat) |
Modifier and Type | Method and Description |
---|---|
Record |
getLastRecord()
Get last received record
|
Integer |
getLastRecordId()
Get last received record's ID
|
List<Throwable> |
getOuterExceptions() |
String |
getOuterExceptionStackTracesAsString() |
IStreaming.IStreamCloser |
getStreamCloser() |
String |
getWrapperId() |
boolean |
hasOuterException() |
boolean |
isEndNodeReceived() |
void |
processNode(OXPathExtractionNode node)
The OXPath engine invokes this method to output extraction nodes.
|
void |
receiveOuterException(Throwable e)
This method is called by the OXPath engine if the exception affecting the output has been received.
|
public static final char VALUE_SEPARATOR_DEFAULT
public static final char ESCAPE_CHAR_DEFAULT
public static final String NEW_LINE_SEPARATOR_DEFAULT
public static final char DELIMETER_DEFAULT
public RecStreamCSVOutputHandler(boolean allowMultipleValuesPerAttribute, String entity, String[] attributes, Appendable output, boolean includeId, int initId, boolean printHeader, RecStreamOutputHandler.IFilter<String> valFilter, RecStreamOutputHandler.IFilter<Record> recFilter)
allowMultipleValuesPerAttribute
- true: multiple values are allowed per attributeentity
- the name of the entityattributes
- attributes to be serialisedoutput
- the consumer of the output recordsincludeId
- true: the id is to be included into the resultinitId
- initial id used for recordsprintHeader
- true: output headers firstvalFilter
- a function for filtering values (can be null)recFilter
- a function for filtering records (can be null)public RecStreamCSVOutputHandler(String wrapperId, boolean allowMultipleValuesPerAttribute, String entity, String[] attributes, Appendable output, boolean includeId, int initId, boolean printHeader, RecStreamOutputHandler.IFilter<String> valFilter, RecStreamOutputHandler.IFilter<Record> recFilter)
wrapperId
- allowMultipleValuesPerAttribute
- true: multiple values are allowed per attributeentity
- the name of the entityattributes
- attributes to be serialisedoutput
- the consumer of the output recordsincludeId
- true: the id is to be included into the resultinitId
- initial id used for recordsprintHeader
- true: output headers firstvalFilter
- a function for filtering values (can be null)recFilter
- a function for filtering records (can be null)public RecStreamCSVOutputHandler(String wrapperId, boolean allowMultipleValuesPerAttribute, String entity, String[] attributes, Appendable output, boolean includeId, int initId, boolean printHeader, RecStreamOutputHandler.IFilter<String> valFilter, RecStreamOutputHandler.IFilter<Record> recFilter, char valueSeparator, char escapeChar, org.apache.commons.csv.CSVFormat csvFileFormat)
wrapperId
- allowMultipleValuesPerAttribute
- true: multiple values are allowed per attributeentity
- the name of the entityattributes
- attributes to be serialisedoutput
- the consumer of the output recordsincludeId
- true: the id is to be included into the resultinitId
- initial id used for recordsprintHeader
- true: output headers firstvalFilter
- a function for filtering values (can be null)recFilter
- a function for filtering records (can be null)valueSeparator
- character to join values of the entity's attributeescapeChar
- escape character used in string join operationcsvFileFormat
- CSV format object (it can be null)public Record getLastRecord()
public Integer getLastRecordId()
public void processNode(OXPathExtractionNode node)
IAbstractOutputHandler
<result>
node, the root. The last node is the "end node".processNode
in interface IAbstractOutputHandler
public void receiveOuterException(Throwable e)
IAbstractOutputHandler
receiveOuterException
in interface IAbstractOutputHandler
public boolean hasOuterException()
hasOuterException
in interface IAbstractOutputHandler
public boolean isEndNodeReceived()
isEndNodeReceived
in interface IOutputHandler
public String getWrapperId()
getWrapperId
in interface IOutputHandler
public List<Throwable> getOuterExceptions()
getOuterExceptions
in interface IOutputHandler
public String getOuterExceptionStackTracesAsString()
getOuterExceptionStackTracesAsString
in interface IOutputHandler
public IStreaming.IStreamCloser getStreamCloser()
getStreamCloser
in interface IStreaming
Copyright © 2020 OXPath Team. All rights reserved.