- 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>
public class BinaryWriter extends AbstractWriter
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
Constructors Constructor Description BinaryWriter()
Writes 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DataFormat
computeFormat(CompositionContext ctx)
Determines the data format for the target.String
getBinaryField()
Gets the name of the field containing the raw binary.String
getFilenameField()
Gets the name of the field containing the output filenames to use when extracting the data.boolean
getMultiple()
Get whether the data is written as a single file or multiple files.void
setBinaryField(String binaryField)
Sets the name of the field containing the raw binary.void
setFilenameField(String filenameField)
Sets the name of the field containing the output filenames to use when extracting the data.void
setMultiple(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, setWriteSingleSink
-
Methods inherited from class com.pervasive.datarush.operators.AbstractLogicalOperator
disableParallelism, getInputPorts, getOutputPorts, newInput, newInput, newOutput, newRecordInput, newRecordInput, newRecordOutput, notifyError
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.pervasive.datarush.operators.LogicalOperator
disableParallelism, getInputPorts, getOutputPorts
-
-
-
-
Constructor Detail
-
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:
AbstractWriter.setTarget(ByteSink)
-
BinaryWriter
public BinaryWriter(String targetFilePath, WriteMode mode)
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 Detail
-
getFilenameField
public String 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
public void setFilenameField(String filenameField)
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
public String getBinaryField()
Gets the name of the field containing the raw binary.- Returns:
- name of the raw binary field
-
setBinaryField
public void setBinaryField(String binaryField)
Sets the name of the field containing the raw binary.- Parameters:
binaryField
-
-
computeFormat
protected DataFormat computeFormat(CompositionContext ctx)
Description copied from class:AbstractWriter
Determines the data format for the target. The returned format is used during composition to construct aWriteSink
operator. If an implementation supports schema discovery, it must be performed in this method.- Specified by:
computeFormat
in classAbstractWriter
- Parameters:
ctx
- the composition context for the current invocation ofAbstractWriter.compose(CompositionContext)
- Returns:
- the target format to use
-
-