Interface DataFormat.DataFormatter
- All Known Implementing Classes:
AbstractRecordFormatter
- Enclosing interface:
- DataFormat
DataFormatter bridges the gap between
records within and outside of a dataflow graph
An implementation represents such a mapping for
some concrete external format.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidbindInput(SteppableRecordValued source) Called to provide the source port from which records to format are read.voidclose()Called to signal that writing is complete.voidCalled to write records to the provided sink in the specified mode.
-
Method Details
-
bindInput
Called to provide the source port from which records to format are read.This method is called once, before
writeData(ByteSink, WriteMode)is called. Any one-time initialization for the formatter should be performed within the implementation of this method.- Parameters:
source- the input port providing records
-
writeData
Called to write records to the provided sink in the specified mode.This method is called once. The implementation is expected to read records from the input passed to
bindInput(RecordInput)and write them to the given sink as requested. The call must not return until end of data has been signaled on the input. Failure to do so will result in an error in the executing graph. Streams opened on the sink are not required to be closed on exit, but it is strongly recommended.- Parameters:
sink- the data sink to which formatted records are to be writtenmode- the access mode for the write
-
close
void close()Called to signal that writing is complete. IfbindInput(RecordInput)has returned successfully, it is guaranteed that this method will be called, even if errors occur.This method is called once, after the last call to
writeData(ByteSink, WriteMode)Any allocated resources which need to be released should be handled within the implementation of this method.
-