Package org.apache.beam.sdk.io
Class FileBasedSink.FileResultCoder<DestinationT>
- java.lang.Object
-
- org.apache.beam.sdk.coders.Coder<T>
-
- org.apache.beam.sdk.coders.StructuredCoder<FileBasedSink.FileResult<DestinationT>>
-
- org.apache.beam.sdk.io.FileBasedSink.FileResultCoder<DestinationT>
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- FileBasedSink<UserT,DestinationT,OutputT>
public static final class FileBasedSink.FileResultCoder<DestinationT> extends StructuredCoder<FileBasedSink.FileResult<DestinationT>>
A coder forFileBasedSink.FileResult
objects.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.beam.sdk.coders.Coder
Coder.Context, Coder.NonDeterministicException
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FileResultCoder(Coder<BoundedWindow> windowCoder, Coder<DestinationT> destinationCoder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FileBasedSink.FileResult<DestinationT>
decode(java.io.InputStream inStream)
Decodes a value of typeT
from the given input stream in the given context.void
encode(FileBasedSink.FileResult<DestinationT> value, java.io.OutputStream outStream)
Encodes the given value of typeT
onto the given output stream.java.util.List<? extends Coder<?>>
getCoderArguments()
java.util.List<? extends Coder<?>>
getComponents()
static <DestinationT>
FileBasedSink.FileResultCoder<DestinationT>of(Coder<BoundedWindow> windowCoder, Coder<DestinationT> destinationCoder)
void
verifyDeterministic()
ThrowCoder.NonDeterministicException
if the coding is not deterministic.-
Methods inherited from class org.apache.beam.sdk.coders.StructuredCoder
equals, hashCode, toString
-
Methods inherited from class org.apache.beam.sdk.coders.Coder
consistentWithEquals, decode, encode, getEncodedElementByteSize, getEncodedTypeDescriptor, isRegisterByteSizeObserverCheap, registerByteSizeObserver, structuralValue, verifyDeterministic, verifyDeterministic
-
-
-
-
Constructor Detail
-
FileResultCoder
protected FileResultCoder(Coder<BoundedWindow> windowCoder, Coder<DestinationT> destinationCoder)
-
-
Method Detail
-
of
public static <DestinationT> FileBasedSink.FileResultCoder<DestinationT> of(Coder<BoundedWindow> windowCoder, Coder<DestinationT> destinationCoder)
-
getCoderArguments
public java.util.List<? extends Coder<?>> getCoderArguments()
Description copied from class:Coder
If this is aCoder
for a parameterized type, returns the list ofCoder
s being used for each of the parameters in the same order they appear within the parameterized type's type signature. If this cannot be done, or thisCoder
does not encode/decode a parameterized type, returns the empty list.- Specified by:
getCoderArguments
in classCoder<FileBasedSink.FileResult<DestinationT>>
-
getComponents
public java.util.List<? extends Coder<?>> getComponents()
Description copied from class:StructuredCoder
Returns the list ofCoders
that are components of thisCoder
.The default components will be equal to the value returned by
Coder.getCoderArguments()
.- Overrides:
getComponents
in classStructuredCoder<FileBasedSink.FileResult<DestinationT>>
-
encode
public void encode(FileBasedSink.FileResult<DestinationT> value, java.io.OutputStream outStream) throws java.io.IOException
Description copied from class:Coder
Encodes the given value of typeT
onto the given output stream.- Specified by:
encode
in classCoder<FileBasedSink.FileResult<DestinationT>>
- Throws:
java.io.IOException
- if writing to theOutputStream
fails for some reasonCoderException
- if the value could not be encoded for some reason
-
decode
public FileBasedSink.FileResult<DestinationT> decode(java.io.InputStream inStream) throws java.io.IOException
Description copied from class:Coder
Decodes a value of typeT
from the given input stream in the given context. Returns the decoded value.- Specified by:
decode
in classCoder<FileBasedSink.FileResult<DestinationT>>
- Throws:
java.io.IOException
- if reading from theInputStream
fails for some reasonCoderException
- if the value could not be decoded for some reason
-
verifyDeterministic
public void verifyDeterministic() throws Coder.NonDeterministicException
Description copied from class:Coder
ThrowCoder.NonDeterministicException
if the coding is not deterministic.In order for a
Coder
to be considered deterministic, the following must be true:- two values that compare as equal (via
Object.equals()
orComparable.compareTo()
, if supported) have the same encoding. - the
Coder
always produces a canonical encoding, which is the same for an instance of an object even if produced on different computers at different times.
- Specified by:
verifyDeterministic
in classCoder<FileBasedSink.FileResult<DestinationT>>
- Throws:
Coder.NonDeterministicException
- if this coder is not deterministic.
- two values that compare as equal (via
-
-