diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java index 956174a5f8..8b00028edc 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/FrameDecoder.java @@ -179,7 +179,7 @@ import org.jboss.netty.handler.codec.replay.ReplayingDecoder; */ public abstract class FrameDecoder extends SimpleChannelUpstreamHandler implements LifeCycleAwareChannelHandler { - private final boolean unfold; + private boolean unfold; protected ChannelBuffer cumulation; private volatile ChannelHandlerContext ctx; private int copyThreshold; @@ -192,6 +192,19 @@ public abstract class FrameDecoder extends SimpleChannelUpstreamHandler implemen this.unfold = unfold; } + public final boolean isUnfold() { + return unfold; + } + + public final void setUnfold(boolean unfold) { + if (ctx == null) { + this.unfold = unfold; + } else { + throw new IllegalStateException( + "decoder properties cannot be changed once the decoder is added to a pipeline."); + } + } + /** * See {@link #setMaxCumulationBufferCapacity(int)} for explaintation of this setting * @@ -224,13 +237,13 @@ public abstract class FrameDecoder extends SimpleChannelUpstreamHandler implemen */ public final void setMaxCumulationBufferCapacity(int copyThreshold) { if (copyThreshold < 0) { - throw new IllegalArgumentException("MaxCumulationBufferCapacity must be >= 0"); + throw new IllegalArgumentException("maxCumulationBufferCapacity must be >= 0"); } if (ctx == null) { this.copyThreshold = copyThreshold; } else { - throw new IllegalStateException("MaxCumulationBufferCapacity " + - "can only be changed before the Decoder was added to the ChannelPipeline"); + throw new IllegalStateException( + "decoder properties cannot be changed once the decoder is added to a pipeline."); } }