public class WriteFixedText extends AbstractTextWriter
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
.
encodingProps
input, options
Constructor and Description |
---|
WriteFixedText()
Writes fixed text to an empty target with default settings.
|
WriteFixedText(ByteSink target,
WriteMode mode)
Writes text to the specified target sink in the
given mode.
|
WriteFixedText(Path path,
WriteMode mode)
Writes fixed text to the specified path in the given mode,
using default settings.
|
WriteFixedText(String path,
WriteMode mode)
Writes fixed text to the specified path in the given mode,
using default settings.
|
Modifier and Type | Method and Description |
---|---|
protected DataFormat |
computeFormat(CompositionContext ctx)
Determines the data format for the target.
|
String |
getRecordSeparator()
Get the record separator.
|
FixedWidthTextRecord |
getSchema()
Get the configured schema.
|
void |
setRecordSeparator(String separator)
Set the record separator.
|
void |
setSchema(FixedWidthTextRecord schema)
Set the schema to use for formatting output records.
|
getCharset, getCharsetName, getEncodeBuffer, getEncoding, getErrorAction, getReplacement, setCharset, setCharsetName, setEncodeBuffer, setEncoding, setErrorAction, setReplacement
compose, getFormatOptions, getInput, getMode, getSaveMetadata, getTarget, getWriteBuffer, getWriteOnClient, getWriteSingleSink, isIgnoreSortOrder, setFormatOptions, setIgnoreSortOrder, setMode, setSaveMetadata, setTarget, setTarget, setTarget, setWriteBuffer, setWriteOnClient, setWriteSingleSink
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
disableParallelism, getInputPorts, getOutputPorts
public WriteFixedText()
public WriteFixedText(String path, WriteMode mode)
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.
path
- the path to writemode
- how to handle existing filessetSchema(FixedWidthTextRecord)
public WriteFixedText(Path path, WriteMode mode)
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.
path
- the path to writemode
- how to handle existing filessetSchema(FixedWidthTextRecord)
public WriteFixedText(ByteSink target, WriteMode 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.
target
- the data sink to which to writemode
- how to handle an existing sinksetSchema(FixedWidthTextRecord)
public void setRecordSeparator(String separator)
separator
- text separating recordspublic String getRecordSeparator()
public void setSchema(FixedWidthTextRecord schema)
schema
- format of output recordspublic FixedWidthTextRecord getSchema()
protected DataFormat computeFormat(CompositionContext ctx)
AbstractWriter
WriteSink
operator. If an
implementation supports schema discovery, it must be
performed in this method.computeFormat
in class AbstractWriter
ctx
- the composition context for the current invocation
of AbstractWriter.compose(CompositionContext)
Copyright © 2020 Actian Corporation. All rights reserved.