@Public public abstract class BinaryOutputFormat<T> extends FileOutputFormat<T>
Modifier and Type | Class and Description |
---|---|
protected class |
BinaryOutputFormat.BlockBasedOutput
Writes a block info at the end of the blocks.
Current implementation uses only int and not long. |
FileOutputFormat.OutputDirectoryMode
Modifier and Type | Field and Description |
---|---|
static String |
BLOCK_SIZE_PARAMETER_KEY
The config parameter which defines the fixed length of a record.
|
static long |
NATIVE_BLOCK_SIZE |
FILE_PARAMETER_KEY, outputFilePath, stream
Constructor and Description |
---|
BinaryOutputFormat() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Method that marks the end of the life-cycle of parallel output instance.
|
protected void |
complementBlockInfo(BlockInfo blockInfo) |
void |
configure(Configuration parameters)
Configures this output format.
|
protected BlockInfo |
createBlockInfo() |
void |
open(int taskNumber,
int numTasks)
Opens a parallel instance of the output format to store the result of its parallel instance.
|
protected abstract void |
serialize(T record,
DataOutputView dataOutput) |
void |
writeRecord(T record)
Adds a record to the output.
|
getDirectoryFileName, getOutputDirectoryMode, getOutputFilePath, getWriteMode, initDefaultsFromConfiguration, initializeGlobal, setOutputDirectoryMode, setOutputFilePath, setWriteMode, tryCleanupOnError
getRuntimeContext, setRuntimeContext
public static final String BLOCK_SIZE_PARAMETER_KEY
public static final long NATIVE_BLOCK_SIZE
public void close() throws IOException
OutputFormat
When this method is called, the output format it guaranteed to be opened.
close
in interface OutputFormat<T>
close
in class FileOutputFormat<T>
IOException
- Thrown, if the input could not be closed properly.protected void complementBlockInfo(BlockInfo blockInfo)
public void configure(Configuration parameters)
OutputFormat
This method is always called first on a newly instantiated output format.
configure
in interface OutputFormat<T>
configure
in class FileOutputFormat<T>
parameters
- The configuration with all parameters.protected BlockInfo createBlockInfo()
public void open(int taskNumber, int numTasks) throws IOException
OutputFormat
When this method is called, the output format it guaranteed to be configured.
open
in interface OutputFormat<T>
open
in class FileOutputFormat<T>
taskNumber
- The number of the parallel instance.numTasks
- The number of parallel tasks.IOException
- Thrown, if the output could not be opened due to an I/O problem.protected abstract void serialize(T record, DataOutputView dataOutput) throws IOException
IOException
public void writeRecord(T record) throws IOException
OutputFormat
When this method is called, the output format it guaranteed to be opened.
record
- The records to add to the output.IOException
- Thrown, if the records could not be added to to an I/O problem.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.