java.lang.Object
com.pervasive.datarush.operators.AbstractLogicalOperator
com.pervasive.datarush.operators.CompositeOperator
com.pervasive.datarush.operators.io.AbstractWriter
com.pervasive.datarush.operators.io.binary.BinaryWriter
- All Implemented Interfaces:
LogicalOperator,RecordSinkOperator,SinkOperator<RecordPort>
Writes raw binary data to a filesystem. This can be used to write any
arbitrary data file as long as the original source filename is known. The
raw binary data is written either into a single file or into multiple files.
The writer must be provided the name of the file to be written including the original extension if applicable and the field that contains the raw binary data. If writing multiple files a folder must be provided and the multiple property must be enabled. Additionally the filename field must be specified when writing multiple files.
-
Field Summary
Fields inherited from class com.pervasive.datarush.operators.io.AbstractWriter
input, options -
Constructor Summary
ConstructorsConstructorDescriptionWrites an empty target with default settings.BinaryWriter(String targetFilePath, WriteMode mode) Writes the binary data to the specified path in the given mode -
Method Summary
Modifier and TypeMethodDescriptionprotected DataFormatDetermines the data format for the target.Gets the name of the field containing the raw binary.Gets the name of the field containing the output filenames to use when extracting the data.booleanGet whether the data is written as a single file or multiple files.voidsetBinaryField(String binaryField) Sets the name of the field containing the raw binary.voidsetFilenameField(String filenameField) Sets the name of the field containing the output filenames to use when extracting the data.voidsetMultiple(boolean multiple) Sets whether the data is written as a single file or multiple files.Methods 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
-
BinaryWriter
public BinaryWriter()Writes an empty target with default settings. The target must be set before execution or an error will be raised.- See Also:
-
BinaryWriter
Writes the binary data to the specified path in the given modeIf writing multiple files, 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.
- Parameters:
targetFilePath- the target to writemode- how to handle existing files
-
-
Method Details
-
getFilenameField
Gets the name of the field containing the output filenames to use when extracting the data.- Returns:
- name of the file name field.
-
setFilenameField
Sets the name of the field containing the output filenames to use when extracting the data.- Parameters:
filenameField-
-
getMultiple
public boolean getMultiple()Get whether the data is written as a single file or multiple files.- Returns:
- whether the data is written as a single or multiple files.
-
setMultiple
public void setMultiple(boolean multiple) Sets whether the data is written as a single file or multiple files.- Parameters:
multiple-
-
getBinaryField
Gets the name of the field containing the raw binary.- Returns:
- name of the raw binary field
-
setBinaryField
Sets the name of the field containing the raw binary.- Parameters:
binaryField-
-
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
-