diff --git a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufDecoder.java b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufDecoder.java index af406486de..37ea9ba30b 100644 --- a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufDecoder.java @@ -29,14 +29,15 @@ import org.jboss.netty.handler.codec.oneone.OneToOneDecoder; import com.google.protobuf.ExtensionRegistry; import com.google.protobuf.Message; +import com.google.protobuf.MessageLite; /** * Decodes a received {@link ChannelBuffer} into a * Google Protocol Buffers - * {@link Message}. Please note that this decoder must be used with a proper - * {@link FrameDecoder} such as {@link LengthFieldBasedFrameDecoder} if you are - * using a stream-based transport such as TCP/IP. A typical setup for TCP/IP - * would be: + * {@link Message} and {@link MessageLite}. Please note that this decoder must + * be used with a proper {@link FrameDecoder} such as {@link ProtobufVarint32FrameDecoder} + * or {@link LengthFieldBasedFrameDecoder} if you are using a stream-based + * transport such as TCP/IP. A typical setup for TCP/IP would be: *
* {@link ChannelPipeline} pipeline = ...; * @@ -71,17 +72,17 @@ import com.google.protobuf.Message; @Sharable public class ProtobufDecoder extends OneToOneDecoder { - private final Message prototype; + private final MessageLite prototype; private final ExtensionRegistry extensionRegistry; /** * Creates a new instance. */ - public ProtobufDecoder(Message prototype) { + public ProtobufDecoder(MessageLite prototype) { this(prototype, null); } - public ProtobufDecoder(Message prototype, ExtensionRegistry extensionRegistry) { + public ProtobufDecoder(MessageLite prototype, ExtensionRegistry extensionRegistry) { if (prototype == null) { throw new NullPointerException("prototype"); } diff --git a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java index 14443957c5..f5e50ce929 100644 --- a/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/protobuf/ProtobufEncoder.java @@ -28,11 +28,12 @@ import org.jboss.netty.handler.codec.frame.LengthFieldPrepender; import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; import com.google.protobuf.Message; +import com.google.protobuf.MessageLite; /** * Encodes the requested Google - * Protocol Buffers {@link Message} into a {@link ChannelBuffer}. - * A typical setup for TCP/IP would be: + * Protocol Buffers {@link Message} and {@link MessageLite} into a + * {@link ChannelBuffer}. A typical setup for TCP/IP would be: ** {@link ChannelPipeline} pipeline = ...; * @@ -77,9 +78,9 @@ public class ProtobufEncoder extends OneToOneEncoder { @Override protected Object encode( ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { - if (!(msg instanceof Message)) { + if (!(msg instanceof MessageLite)) { return msg; } - return wrappedBuffer(((Message) msg).toByteArray()); + return wrappedBuffer(((MessageLite) msg).toByteArray()); } }