Package org.apache.beam.sdk.io
Interface FileIO.Sink<ElementT>
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
AvroIO.Sink
,TextIO.Sink
,TFRecordIO.Sink
- Enclosing class:
- FileIO
public static interface FileIO.Sink<ElementT> extends java.io.Serializable
Specifies how to write elements to individual files inFileIO.write()
andFileIO.writeDynamic()
. A new instance ofFileIO.Sink
is created for every file being written.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
flush()
Flushes the buffered state (if any) before the channel is closed.void
open(java.nio.channels.WritableByteChannel channel)
Initializes writing to the given channel.void
write(ElementT element)
Appends a single element to the file.
-
-
-
Method Detail
-
open
void open(java.nio.channels.WritableByteChannel channel) throws java.io.IOException
Initializes writing to the given channel. Will be invoked once on a givenFileIO.Sink
instance.- Throws:
java.io.IOException
-
write
void write(ElementT element) throws java.io.IOException
Appends a single element to the file. May be invoked zero or more times.- Throws:
java.io.IOException
-
flush
void flush() throws java.io.IOException
Flushes the buffered state (if any) before the channel is closed. Does not need to close the channel. Will be invoked once.- Throws:
java.io.IOException
-
-