T - type of element handled by coder.public class ThriftCoder<T> extends CustomCoder<T>
Coder using a Thrift TProtocol to
serialize/deserialize elements.Coder.Context, Coder.NonDeterministicException| Modifier | Constructor and Description |
|---|---|
protected |
ThriftCoder(java.lang.Class<T> type,
org.apache.thrift.protocol.TProtocolFactory protocolFactory) |
| Modifier and Type | Method and Description |
|---|---|
T |
decode(java.io.InputStream inStream)
Decodes a value of type
T from the given input stream using provided protocolFactory. |
void |
encode(T value,
java.io.OutputStream outStream)
Encodes the given value of type
T onto the given output stream using provided protocolFactory. |
static <T> ThriftCoder<T> |
of(java.lang.Class<T> clazz,
org.apache.thrift.protocol.TProtocolFactory protocolFactory)
|
getCoderArguments, verifyDeterministicconsistentWithEquals, decode, encode, getEncodedElementByteSize, getEncodedTypeDescriptor, isRegisterByteSizeObserverCheap, registerByteSizeObserver, structuralValue, verifyDeterministic, verifyDeterministicprotected ThriftCoder(java.lang.Class<T> type, org.apache.thrift.protocol.TProtocolFactory protocolFactory)
public static <T> ThriftCoder<T> of(java.lang.Class<T> clazz, org.apache.thrift.protocol.TProtocolFactory protocolFactory)
T - element typeclazz - TBase class used to decode into/ encode from.protocolFactory - factory for TProtocol to be used to encode/decode.TProtocolFactory
used to encode/decode.public void encode(T value, java.io.OutputStream outStream) throws CoderException, java.io.IOException
T onto the given output stream using provided protocolFactory.encode in class Coder<T>value - TBase to encode.outStream - stream to output encoded value to.java.io.IOException - if writing to the OutputStream fails for some reasonCoderException - if the value could not be encoded for some reasonpublic T decode(java.io.InputStream inStream) throws CoderException, java.io.IOException
T from the given input stream using provided protocolFactory. Returns the decoded value.decode in class Coder<T>inStream - stream of input values to be decodedTBase decoded objectjava.io.IOException - if reading from the InputStream fails for some reasonCoderException - if the value could not be decoded for some reason