- All Implemented Interfaces:
LogicalOperator,RecordSinkOperator,SinkOperator<RecordPort>
FixedWidthTextRecord to determine how
field values are formatted. Fields are mapped by name; all fields
defined in the schema must be present in the input (and vice-versa),
although they need not be in the same order. The order of fields
in the formatted record is determined by the order in the supplied
schema. Records in the file are separated by a non-empty,
user-defined character sequence.
The record schema can be manually constructed via the API provided,
although though this metadata is often persisted externally. Support for
Pervasive DataIntegrator structured schema descriptors (.schema files) is
provided with StructuredSchemaReader.
-
Field Summary
Fields inherited from class com.pervasive.datarush.operators.io.textfile.AbstractTextWriter
encodingPropsFields inherited from class com.pervasive.datarush.operators.io.AbstractWriter
input, options -
Constructor Summary
ConstructorsConstructorDescriptionWrites fixed text to an empty target with default settings.WriteFixedText(Path path, WriteMode mode) Writes fixed text to the specified path in the given mode, using default settings.WriteFixedText(ByteSink target, WriteMode mode) Writes text to the specified target sink in the given mode.WriteFixedText(String path, WriteMode mode) Writes fixed text to the specified path in the given mode, using default settings. -
Method Summary
Modifier and TypeMethodDescriptionprotected DataFormatDetermines the data format for the target.Get the record separator.Get the configured schema.voidsetRecordSeparator(String separator) Set the record separator.voidsetSchema(FixedWidthTextRecord schema) Set the schema to use for formatting output records.Methods inherited from class com.pervasive.datarush.operators.io.textfile.AbstractTextWriter
getCharset, getCharsetName, getEncodeBuffer, getEncoding, getErrorAction, getReplacement, setCharset, setCharsetName, setEncodeBuffer, setEncoding, setErrorAction, setReplacementMethods inherited from class com.pervasive.datarush.operators.io.AbstractWriter
compose, getFormatOptions, getInput, getMode, getSaveMetadata, getTarget, getWriteBuffer, getWriteOnClient, getWriteSingleSink, isIgnoreSortOrder, setFormatOptions, setIgnoreSortOrder, setMode, setSaveMetadata, setTarget, setTarget, setTarget, setWriteBuffer, setWriteOnClient, setWriteSingleSinkMethods inherited from class com.pervasive.datarush.operators.AbstractLogicalOperator
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyErrorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.pervasive.datarush.operators.LogicalOperator
disableParallelism, getInputPorts, getOutputPorts
-
Constructor Details
-
WriteFixedText
public WriteFixedText()Writes fixed text to an empty target with default settings. Note the target and schema must be set before execution or an error will be raised. -
WriteFixedText
Writes fixed text to the specified path in the given mode, using default settings.If the writer is parallelized, this is interpreted as a directory in which each partition will write a fragment of the entire input stream. Otherwise, it is interpreted as the file to write.
The schema must be set before execution or an error will be raised.
- Parameters:
path- the path to writemode- how to handle existing files- See Also:
-
WriteFixedText
Writes fixed text to the specified path in the given mode, using default settings.If the writer is parallelized, this is interpreted as a directory in which each partition will write a fragment of the entire input stream. Otherwise, it is interpreted as the file to write.
The schema must be set before execution or an error will be raised.
- Parameters:
path- the path to writemode- how to handle existing files- See Also:
-
WriteFixedText
Writes text to the specified target sink in the given mode.The writer can only be parallelized if the sink is fragmentable. In this case, each partition will be written as an independent sink. Otherwise, the writer will run non-parallel.
The schema must be set before execution or an error will be raised.
- Parameters:
target- the data sink to which to writemode- how to handle an existing sink- See Also:
-
-
Method Details
-
setRecordSeparator
Set the record separator. This string will be output at the end of each record written. The default value is the system dependent record separator.- Parameters:
separator- text separating records
-
getRecordSeparator
Get the record separator.- Returns:
- record separator
-
setSchema
Set the schema to use for formatting output records. The schema is required. The schema defines the field names, types, positions, sizes and formatting specifications.- Parameters:
schema- format of output records
-
getSchema
Get the configured schema.- Returns:
- schema
-
computeFormat
Description copied from class:AbstractWriterDetermines the data format for the target. The returned format is used during composition to construct aWriteSinkoperator. If an implementation supports schema discovery, it must be performed in this method.- Specified by:
computeFormatin classAbstractWriter- Parameters:
ctx- the composition context for the current invocation ofAbstractWriter.compose(CompositionContext)- Returns:
- the target format to use
-