Package org.apache.flink.api.common.io
Class BinaryOutputFormat<T>
- java.lang.Object
-
- org.apache.flink.api.common.io.RichOutputFormat<IT>
-
- org.apache.flink.api.common.io.FileOutputFormat<T>
-
- org.apache.flink.api.common.io.BinaryOutputFormat<T>
-
- All Implemented Interfaces:
Serializable,CleanupWhenUnsuccessful,InitializeOnMaster,OutputFormat<T>
- Direct Known Subclasses:
SerializedOutputFormat
@Public public abstract class BinaryOutputFormat<T> extends FileOutputFormat<T>
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classBinaryOutputFormat.BlockBasedOutputWrites a block info at the end of the blocks.
Current implementation uses only int and not long.-
Nested classes/interfaces inherited from class org.apache.flink.api.common.io.FileOutputFormat
FileOutputFormat.OutputDirectoryMode
-
Nested classes/interfaces inherited from interface org.apache.flink.api.common.io.OutputFormat
OutputFormat.InitializationContext
-
-
Field Summary
Fields Modifier and Type Field Description static StringBLOCK_SIZE_PARAMETER_KEYThe config parameter which defines the fixed length of a record.static longNATIVE_BLOCK_SIZE-
Fields inherited from class org.apache.flink.api.common.io.FileOutputFormat
FILE_PARAMETER_KEY, outputFilePath, stream
-
-
Constructor Summary
Constructors Constructor Description BinaryOutputFormat()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Method that marks the end of the life-cycle of parallel output instance.protected voidcomplementBlockInfo(BlockInfo blockInfo)voidconfigure(Configuration parameters)Configures this output format.protected BlockInfocreateBlockInfo()voidopen(int taskNumber, int numTasks)Opens a parallel instance of the output format to store the result of its parallel instance.protected abstract voidserialize(T record, DataOutputView dataOutput)voidwriteRecord(T record)Adds a record to the output.-
Methods inherited from class org.apache.flink.api.common.io.FileOutputFormat
getDirectoryFileName, getOutputDirectoryMode, getOutputFilePath, getWriteMode, initDefaultsFromConfiguration, initializeGlobal, setOutputDirectoryMode, setOutputFilePath, setWriteMode, tryCleanupOnError
-
Methods inherited from class org.apache.flink.api.common.io.RichOutputFormat
getRuntimeContext, setRuntimeContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.api.common.io.OutputFormat
open
-
-
-
-
Field Detail
-
BLOCK_SIZE_PARAMETER_KEY
public static final String BLOCK_SIZE_PARAMETER_KEY
The config parameter which defines the fixed length of a record.- See Also:
- Constant Field Values
-
NATIVE_BLOCK_SIZE
public static final long NATIVE_BLOCK_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
close
public void close() throws IOExceptionDescription copied from interface:OutputFormatMethod that marks the end of the life-cycle of parallel output instance. Should be used to close channels and streams and release resources. After this method returns without an error, the output is assumed to be correct.When this method is called, the output format it guaranteed to be opened.
- Specified by:
closein interfaceOutputFormat<T>- Overrides:
closein classFileOutputFormat<T>- Throws:
IOException- Thrown, if the input could not be closed properly.
-
complementBlockInfo
protected void complementBlockInfo(BlockInfo blockInfo)
-
configure
public void configure(Configuration parameters)
Description copied from interface:OutputFormatConfigures this output format. Since output formats are instantiated generically and hence parameterless, this method is the place where the output formats set their basic fields based on configuration values.This method is always called first on a newly instantiated output format.
- Specified by:
configurein interfaceOutputFormat<T>- Overrides:
configurein classFileOutputFormat<T>- Parameters:
parameters- The configuration with all parameters.
-
createBlockInfo
protected BlockInfo createBlockInfo()
-
open
public void open(int taskNumber, int numTasks) throws IOExceptionDescription copied from interface:OutputFormatOpens a parallel instance of the output format to store the result of its parallel instance.When this method is called, the output format it guaranteed to be configured.
- Specified by:
openin interfaceOutputFormat<T>- Overrides:
openin classFileOutputFormat<T>- Parameters:
taskNumber- The number of the parallel instance.numTasks- The number of parallel tasks.- Throws:
IOException- Thrown, if the output could not be opened due to an I/O problem.
-
serialize
protected abstract void serialize(T record, DataOutputView dataOutput) throws IOException
- Throws:
IOException
-
writeRecord
public void writeRecord(T record) throws IOException
Description copied from interface:OutputFormatAdds a record to the output.When this method is called, the output format it guaranteed to be opened.
- Parameters:
record- The records to add to the output.- Throws:
IOException- Thrown, if the records could not be added due to an I/O problem.
-
-