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
ConstructorsModifierConstructorDescriptionprotectedThriftCoder(Class<T> type, org.apache.thrift.protocol.TProtocolFactory protocolFactory) -
Method Summary
Modifier and TypeMethodDescriptiondecode(InputStream inStream) Decodes a value of typeTfrom the given input stream using providedprotocolFactory.voidencode(T value, OutputStream outStream) Encodes the given value of typeTonto the given output stream using providedprotocolFactory.static <T> ThriftCoder<T> Methods inherited from class org.apache.beam.sdk.coders.CustomCoder
getCoderArguments, verifyDeterministicMethods 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-TBaseclass used to decode into/ encode from.protocolFactory- factory forTProtocolto be used to encode/decode.- Returns:
- ThriftCoder initialize with class to be encoded/decoded and
TProtocolFactoryused to encode/decode.
-
encode
Encodes the given value of typeTonto the given output stream using providedprotocolFactory.- Specified by:
encodein classCoder<T>- Parameters:
value-TBaseto encode.outStream- stream to output encoded value to.- Throws:
IOException- if writing to theOutputStreamfails for some reasonCoderException- if the value could not be encoded for some reason
-
decode
Decodes a value of typeTfrom the given input stream using providedprotocolFactory. Returns the decoded value.- Specified by:
decodein classCoder<T>- Parameters:
inStream- stream of input values to be decoded- Returns:
TBasedecoded object- Throws:
IOException- if reading from theInputStreamfails for some reasonCoderException- if the value could not be decoded for some reason
-