public final class ProtobufSerializationProvider extends java.lang.Object implements SerializationProvider
SerializationProvider for serializing/deserializing
protocol buffer objects.
Note: This implementation assumes byte streams represent a single message. This implementation currently uses
writeTo/parseFrom and not writeDelimitedTo/parseDelimitedFrom to serialize/deserialize messages.
It cannot be used to process a stream of delimited messages on a single Buffer.| Constructor and Description |
|---|
ProtobufSerializationProvider() |
ProtobufSerializationProvider(java.util.function.Function<java.lang.Class<?>,com.google.protobuf.Parser<?>> parserForClass) |
| Modifier and Type | Method and Description |
|---|---|
<T> StreamingDeserializer<T> |
getDeserializer(java.lang.Class<T> classToDeSerialize)
Provide a
StreamingDeserializer instance that can deserialize instances of T. |
<T> StreamingDeserializer<T> |
getDeserializer(TypeHolder<T> typeToDeserialize)
Provide a
StreamingDeserializer instance that can deserialize instances of T. |
<T> StreamingSerializer |
getSerializer(java.lang.Class<T> classToSerialize)
Provide a
StreamingSerializer instance that can serialize instances of T. |
<T> StreamingSerializer |
getSerializer(TypeHolder<T> typeToSerialize)
Provide a
StreamingSerializer instance that can serialize instances of T. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitserializepublic ProtobufSerializationProvider()
public ProtobufSerializationProvider(java.util.function.Function<java.lang.Class<?>,com.google.protobuf.Parser<?>> parserForClass)
public <T> StreamingSerializer getSerializer(java.lang.Class<T> classToSerialize)
SerializationProviderStreamingSerializer instance that can serialize instances of T.getSerializer in interface SerializationProviderT - The data type to serialize.classToSerialize - The class for T, the object to be serialized.StreamingSerializer that can serialize instances of T.public <T> StreamingSerializer getSerializer(TypeHolder<T> typeToSerialize)
SerializationProviderStreamingSerializer instance that can serialize instances of T.getSerializer in interface SerializationProviderT - The data type to serialize.typeToSerialize - TypeHolder holding the ParameterizedType to be serialized.StreamingSerializer that can serialize instances of T.public <T> StreamingDeserializer<T> getDeserializer(java.lang.Class<T> classToDeSerialize)
SerializationProviderStreamingDeserializer instance that can deserialize instances of T.getDeserializer in interface SerializationProviderT - The data type to deserialize.classToDeSerialize - The class for T, the object to be deserialized.StreamingDeserializer that can deserialize instances of T.public <T> StreamingDeserializer<T> getDeserializer(TypeHolder<T> typeToDeserialize)
SerializationProviderStreamingDeserializer instance that can deserialize instances of T.getDeserializer in interface SerializationProviderT - The data type to deserialize.typeToDeserialize - TypeHolder holding the ParameterizedType to be deserialized.StreamingDeserializer that can deserialize instances of T.