All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.protostream.impl.RawProtobufMarshallerDelegate Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.infinispan.protostream.impl;

import java.io.IOException;

import org.infinispan.protostream.RawProtoStreamReader;
import org.infinispan.protostream.RawProtoStreamWriter;
import org.infinispan.protostream.RawProtobufMarshaller;
import org.infinispan.protostream.descriptors.FieldDescriptor;

/**
 * @author [email protected]
 * @since 1.0
 */
final class RawProtobufMarshallerDelegate implements BaseMarshallerDelegate {

   private final RawProtobufMarshaller marshaller;

   private final SerializationContextImpl ctx;

   public RawProtobufMarshallerDelegate(SerializationContextImpl ctx, RawProtobufMarshaller marshaller) {
      this.ctx = ctx;
      this.marshaller = marshaller;
   }

   @Override
   public RawProtobufMarshaller getMarshaller() {
      return marshaller;
   }

   @Override
   public void marshall(FieldDescriptor fieldDescriptor, T value, ProtoStreamWriterImpl writer, RawProtoStreamWriter out) throws IOException {
      marshaller.writeTo(ctx, out, value);
   }

   @Override
   public T unmarshall(FieldDescriptor fieldDescriptor, ProtoStreamReaderImpl reader, RawProtoStreamReader in) throws IOException {
      return marshaller.readFrom(ctx, in);
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy