Package org.apache.beam.sdk.io.thrift
Class ThriftCoder<T>
java.lang.Object
org.apache.beam.sdk.coders.Coder<T>
org.apache.beam.sdk.coders.CustomCoder<T>
org.apache.beam.sdk.io.thrift.ThriftCoder<T>
- Type Parameters:
T
- type of element handled by coder.
- All Implemented Interfaces:
Serializable
A
Coder
using a Thrift TProtocol
to
serialize/deserialize elements.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.beam.sdk.coders.Coder
Coder.Context, Coder.NonDeterministicException
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ThriftCoder
(Class<T> type, org.apache.thrift.protocol.TProtocolFactory protocolFactory) -
Method Summary
Modifier and TypeMethodDescriptiondecode
(InputStream inStream) Decodes a value of typeT
from the given input stream using providedprotocolFactory
.void
encode
(T value, OutputStream outStream) Encodes the given value of typeT
onto the given output stream using providedprotocolFactory
.static <T> ThriftCoder
<T> Methods inherited from class org.apache.beam.sdk.coders.CustomCoder
getCoderArguments, verifyDeterministic
Methods inherited from class org.apache.beam.sdk.coders.Coder
consistentWithEquals, decode, encode, getEncodedElementByteSize, getEncodedElementByteSizeUsingCoder, getEncodedTypeDescriptor, isRegisterByteSizeObserverCheap, registerByteSizeObserver, structuralValue, verifyDeterministic, verifyDeterministic
-
Constructor Details
-
ThriftCoder
-
-
Method Details
-
of
public static <T> ThriftCoder<T> of(Class<T> clazz, org.apache.thrift.protocol.TProtocolFactory protocolFactory) - Type Parameters:
T
- element type- Parameters:
clazz
-TBase
class used to decode into/ encode from.protocolFactory
- factory forTProtocol
to be used to encode/decode.- Returns:
- ThriftCoder initialize with class to be encoded/decoded and
TProtocolFactory
used to encode/decode.
-
encode
Encodes the given value of typeT
onto the given output stream using providedprotocolFactory
.- Specified by:
encode
in classCoder<T>
- Parameters:
value
-TBase
to encode.outStream
- stream to output encoded value to.- Throws:
IOException
- if writing to theOutputStream
fails for some reasonCoderException
- if the value could not be encoded for some reason
-
decode
Decodes a value of typeT
from the given input stream using providedprotocolFactory
. Returns the decoded value.- Specified by:
decode
in classCoder<T>
- Parameters:
inStream
- stream of input values to be decoded- Returns:
TBase
decoded object- Throws:
IOException
- if reading from theInputStream
fails for some reasonCoderException
- if the value could not be decoded for some reason
-