[#846] Tighten up visibility

This commit is contained in:
Norman Maurer 2012-12-25 18:54:55 +01:00
parent 5bd3648b3d
commit 852f546b5b
51 changed files with 62 additions and 61 deletions

View File

@ -110,7 +110,7 @@ public class HttpChunkAggregator extends MessageToMessageDecoder<HttpObject, Htt
} }
@Override @Override
public HttpMessage decode(ChannelHandlerContext ctx, HttpObject msg) throws Exception { protected HttpMessage decode(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
HttpMessage currentMessage = this.currentMessage; HttpMessage currentMessage = this.currentMessage;
if (msg instanceof HttpMessage) { if (msg instanceof HttpMessage) {

View File

@ -82,7 +82,7 @@ public class HttpClientCodec extends CombinedChannelHandler {
private final class Encoder extends HttpRequestEncoder { private final class Encoder extends HttpRequestEncoder {
@Override @Override
public void encode( protected void encode(
ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception { ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
if (msg instanceof HttpRequest && !done) { if (msg instanceof HttpRequest && !done) {
queue.offer(((HttpRequest) msg).getMethod()); queue.offer(((HttpRequest) msg).getMethod());
@ -109,7 +109,7 @@ public class HttpClientCodec extends CombinedChannelHandler {
} }
@Override @Override
public Object decode( protected Object decode(
ChannelHandlerContext ctx, ByteBuf buffer) throws Exception { ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
if (done) { if (done) {
return buffer.readBytes(actualReadableBytes()); return buffer.readBytes(actualReadableBytes());

View File

@ -52,7 +52,7 @@ public abstract class HttpContentDecoder extends MessageToMessageDecoder<Object,
} }
@Override @Override
public Object decode(ChannelHandlerContext ctx, Object msg) throws Exception { protected Object decode(ChannelHandlerContext ctx, Object msg) throws Exception {
if (msg instanceof HttpResponse && ((HttpResponse) msg).getStatus().getCode() == 100) { if (msg instanceof HttpResponse && ((HttpResponse) msg).getStatus().getCode() == 100) {
// 100-continue response must be passed through. // 100-continue response must be passed through.
return msg; return msg;

View File

@ -61,7 +61,7 @@ public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpMessa
} }
@Override @Override
public HttpMessage decode(ChannelHandlerContext ctx, HttpMessage msg) protected HttpMessage decode(ChannelHandlerContext ctx, HttpMessage msg)
throws Exception { throws Exception {
String acceptedEncoding = msg.getHeader(HttpHeaders.Names.ACCEPT_ENCODING); String acceptedEncoding = msg.getHeader(HttpHeaders.Names.ACCEPT_ENCODING);
if (acceptedEncoding == null) { if (acceptedEncoding == null) {

View File

@ -168,7 +168,7 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<Object, HttpMe
} }
@Override @Override
public Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception { protected Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
switch (state()) { switch (state()) {
case SKIP_CONTROL_CHARS: { case SKIP_CONTROL_CHARS: {
try { try {

View File

@ -54,7 +54,7 @@ public abstract class HttpMessageEncoder extends MessageToByteEncoder<Object> {
} }
@Override @Override
public void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception { protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
if (msg instanceof HttpMessage) { if (msg instanceof HttpMessage) {
HttpMessage m = (HttpMessage) msg; HttpMessage m = (HttpMessage) msg;
HttpTransferEncoding te = m.getTransferEncoding(); HttpTransferEncoding te = m.getTransferEncoding();

View File

@ -74,7 +74,7 @@ public abstract class RtspMessageDecoder extends HttpMessageDecoder {
} }
@Override @Override
public Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception { protected Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
Object o = super.decode(ctx, buffer); Object o = super.decode(ctx, buffer);
if (o != null && aggregator.writeInbound(o)) { if (o != null && aggregator.writeInbound(o)) {
return aggregator.readInbound(); return aggregator.readInbound();

View File

@ -39,7 +39,7 @@ public abstract class RtspMessageEncoder extends HttpMessageEncoder {
} }
@Override @Override
public void encode(ChannelHandlerContext ctx, Object msg, protected void encode(ChannelHandlerContext ctx, Object msg,
ByteBuf out) throws Exception { ByteBuf out) throws Exception {
// Ignore unrelated message types such as HttpChunk. // Ignore unrelated message types such as HttpChunk.
if (!(msg instanceof HttpMessage)) { if (!(msg instanceof HttpMessage)) {

View File

@ -101,7 +101,7 @@ public class SpdyFrameDecoder extends ByteToMessageDecoder<Object> {
} }
@Override @Override
public Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception { protected Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
switch(state) { switch(state) {
case READ_COMMON_HEADER: case READ_COMMON_HEADER:
state = readCommonHeader(buffer); state = readCommonHeader(buffer);

View File

@ -78,7 +78,7 @@ public class SpdyFrameEncoder extends MessageToByteEncoder<Object> {
} }
@Override @Override
public void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception { protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
if (msg instanceof SpdyDataFrame) { if (msg instanceof SpdyDataFrame) {
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg; SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;

View File

@ -38,7 +38,7 @@ public class SpdyHttpResponseStreamIdHandler extends
} }
@Override @Override
public HttpMessage encode(ChannelHandlerContext ctx, HttpMessage msg) throws Exception { protected HttpMessage encode(ChannelHandlerContext ctx, HttpMessage msg) throws Exception {
Integer id = ids.poll(); Integer id = ids.poll();
if (id != null && id.intValue() != NO_ID && !msg.containsHeader(SpdyHttpHeaders.Names.STREAM_ID)) { if (id != null && id.intValue() != NO_ID && !msg.containsHeader(SpdyHttpHeaders.Names.STREAM_ID)) {
SpdyHttpHeaders.setStreamId(msg, id); SpdyHttpHeaders.setStreamId(msg, id);
@ -47,7 +47,7 @@ public class SpdyHttpResponseStreamIdHandler extends
} }
@Override @Override
public Object decode(ChannelHandlerContext ctx, Object msg) throws Exception { protected Object decode(ChannelHandlerContext ctx, Object msg) throws Exception {
if (msg instanceof HttpMessage) { if (msg instanceof HttpMessage) {
boolean contains = ((HttpMessage) msg).containsHeader(SpdyHttpHeaders.Names.STREAM_ID); boolean contains = ((HttpMessage) msg).containsHeader(SpdyHttpHeaders.Names.STREAM_ID);
if (!contains) { if (!contains) {

View File

@ -109,14 +109,14 @@ public abstract class ByteToByteCodec
/** /**
* @see {@link ByteToByteEncoder#encode(ChannelHandlerContext, ByteBuf, ByteBuf)} * @see {@link ByteToByteEncoder#encode(ChannelHandlerContext, ByteBuf, ByteBuf)}
*/ */
public abstract void encode( protected abstract void encode(
ChannelHandlerContext ctx, ChannelHandlerContext ctx,
ByteBuf in, ByteBuf out) throws Exception; ByteBuf in, ByteBuf out) throws Exception;
/** /**
* @see {@link ByteToByteDecoder#decode(ChannelHandlerContext, ByteBuf, ByteBuf)} * @see {@link ByteToByteDecoder#decode(ChannelHandlerContext, ByteBuf, ByteBuf)}
*/ */
public abstract void decode( protected abstract void decode(
ChannelHandlerContext ctx, ChannelHandlerContext ctx,
ByteBuf in, ByteBuf out) throws Exception; ByteBuf in, ByteBuf out) throws Exception;
} }

View File

@ -111,7 +111,7 @@ public abstract class ByteToByteDecoder extends ChannelInboundByteHandlerAdapter
* @param out the {@link ByteBuf} to which the decoded data will be written * @param out the {@link ByteBuf} to which the decoded data will be written
* @throws Exception is thrown if an error accour * @throws Exception is thrown if an error accour
*/ */
public abstract void decode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception; protected abstract void decode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception;
/** /**
* Is called one last time when the {@link ChannelHandlerContext} goes in-active. Which means the * Is called one last time when the {@link ChannelHandlerContext} goes in-active. Which means the
@ -120,7 +120,7 @@ public abstract class ByteToByteDecoder extends ChannelInboundByteHandlerAdapter
* By default this will just call {@link #decode(ChannelHandlerContext, ByteBuf, ByteBuf)} but sub-classes may * By default this will just call {@link #decode(ChannelHandlerContext, ByteBuf, ByteBuf)} but sub-classes may
* override this for some special cleanup operation. * override this for some special cleanup operation.
*/ */
public void decodeLast(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception { protected void decodeLast(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
decode(ctx, in, out); decode(ctx, in, out);
} }
} }

View File

@ -79,5 +79,5 @@ public abstract class ByteToByteEncoder extends ChannelOutboundByteHandlerAdapte
* @param out the {@link ByteBuf} to which the decoded data will be written * @param out the {@link ByteBuf} to which the decoded data will be written
* @throws Exception is thrown if an error accour * @throws Exception is thrown if an error accour
*/ */
public abstract void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception; protected abstract void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception;
} }

View File

@ -80,10 +80,10 @@ public abstract class ByteToMessageCodec<INBOUND_OUT, OUTBOUND_IN>
encoder.freeOutboundBuffer(ctx, buf); encoder.freeOutboundBuffer(ctx, buf);
} }
public abstract void encode( protected abstract void encode(
ChannelHandlerContext ctx, ChannelHandlerContext ctx,
OUTBOUND_IN msg, ByteBuf out) throws Exception; OUTBOUND_IN msg, ByteBuf out) throws Exception;
public abstract INBOUND_OUT decode( protected abstract INBOUND_OUT decode(
ChannelHandlerContext ctx, ByteBuf in) throws Exception; ChannelHandlerContext ctx, ByteBuf in) throws Exception;
} }

View File

@ -166,7 +166,7 @@ public abstract class ByteToMessageDecoder<O>
* there was not enough data left in the {@link ByteBuf} to decode. * there was not enough data left in the {@link ByteBuf} to decode.
* @throws Exception is thrown if an error accour * @throws Exception is thrown if an error accour
*/ */
public abstract O decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception; protected abstract O decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception;
/** /**
* Is called one last time when the {@link ChannelHandlerContext} goes in-active. Which means the * Is called one last time when the {@link ChannelHandlerContext} goes in-active. Which means the
@ -175,7 +175,7 @@ public abstract class ByteToMessageDecoder<O>
* By default this will just call {@link #decode(ChannelHandlerContext, ByteBuf)} but sub-classes may * By default this will just call {@link #decode(ChannelHandlerContext, ByteBuf)} but sub-classes may
* override this for some special cleanup operation. * override this for some special cleanup operation.
*/ */
public O decodeLast(ChannelHandlerContext ctx, ByteBuf in) throws Exception { protected O decodeLast(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
return decode(ctx, in); return decode(ctx, in);
} }
} }

View File

@ -209,8 +209,9 @@ public class DelimiterBasedFrameDecoder extends ByteToMessageDecoder<Object> {
private boolean isSubclass() { private boolean isSubclass() {
return getClass() != DelimiterBasedFrameDecoder.class; return getClass() != DelimiterBasedFrameDecoder.class;
} }
@Override @Override
public Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception { protected Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
if (lineBasedDecoder != null) { if (lineBasedDecoder != null) {
return lineBasedDecoder.decode(ctx, buffer); return lineBasedDecoder.decode(ctx, buffer);
} }

View File

@ -74,7 +74,7 @@ public class FixedLengthFrameDecoder extends ByteToMessageDecoder<Object> {
} }
@Override @Override
public Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception { protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
if (in.readableBytes() < frameLength) { if (in.readableBytes() < frameLength) {
return null; return null;
} else { } else {

View File

@ -307,7 +307,7 @@ public class LengthFieldBasedFrameDecoder extends ByteToMessageDecoder<Object> {
} }
@Override @Override
public Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception { protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
if (discardingTooLongFrame) { if (discardingTooLongFrame) {
long bytesToDiscard = this.bytesToDiscard; long bytesToDiscard = this.bytesToDiscard;
int localBytesToDiscard = (int) Math.min(bytesToDiscard, in.readableBytes()); int localBytesToDiscard = (int) Math.min(bytesToDiscard, in.readableBytes());

View File

@ -95,7 +95,7 @@ public class LengthFieldPrepender extends MessageToByteEncoder<ByteBuf> {
} }
@Override @Override
public void encode( protected void encode(
ChannelHandlerContext ctx, ChannelHandlerContext ctx,
ByteBuf msg, ByteBuf out) throws Exception { ByteBuf msg, ByteBuf out) throws Exception {

View File

@ -67,7 +67,7 @@ public class LineBasedFrameDecoder extends ByteToMessageDecoder<ByteBuf> {
} }
@Override @Override
public ByteBuf decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception { protected ByteBuf decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
final int eol = findEndOfLine(buffer); final int eol = findEndOfLine(buffer);
if (eol != -1) { if (eol != -1) {

View File

@ -104,5 +104,5 @@ public abstract class MessageToByteEncoder<I> extends ChannelOutboundMessageHand
* @param out the {@link ByteBuf} into which the encoded message will be written * @param out the {@link ByteBuf} into which the encoded message will be written
* @throws Exception is thrown if an error accour * @throws Exception is thrown if an error accour
*/ */
public abstract void encode(ChannelHandlerContext ctx, I msg, ByteBuf out) throws Exception; protected abstract void encode(ChannelHandlerContext ctx, I msg, ByteBuf out) throws Exception;
} }

View File

@ -142,6 +142,6 @@ public abstract class MessageToMessageCodec<INBOUND_IN, INBOUND_OUT, OUTBOUND_IN
return ChannelHandlerUtil.acceptMessage(acceptedOutboundMsgTypes, msg); return ChannelHandlerUtil.acceptMessage(acceptedOutboundMsgTypes, msg);
} }
public abstract OUTBOUND_OUT encode(ChannelHandlerContext ctx, OUTBOUND_IN msg) throws Exception; protected abstract OUTBOUND_OUT encode(ChannelHandlerContext ctx, OUTBOUND_IN msg) throws Exception;
public abstract INBOUND_OUT decode(ChannelHandlerContext ctx, INBOUND_IN msg) throws Exception; protected abstract INBOUND_OUT decode(ChannelHandlerContext ctx, INBOUND_IN msg) throws Exception;
} }

View File

@ -121,5 +121,5 @@ public abstract class MessageToMessageDecoder<I, O>
* needs to do some kind of aggragation * needs to do some kind of aggragation
* @throws Exception is thrown if an error accour * @throws Exception is thrown if an error accour
*/ */
public abstract O decode(ChannelHandlerContext ctx, I msg) throws Exception; protected abstract O decode(ChannelHandlerContext ctx, I msg) throws Exception;
} }

View File

@ -111,5 +111,5 @@ public abstract class MessageToMessageEncoder<I, O> extends ChannelOutboundMessa
* needs to do some kind of aggragation * needs to do some kind of aggragation
* @throws Exception is thrown if an error accour * @throws Exception is thrown if an error accour
*/ */
public abstract O encode(ChannelHandlerContext ctx, I msg) throws Exception; protected abstract O encode(ChannelHandlerContext ctx, I msg) throws Exception;
} }

View File

@ -62,7 +62,7 @@ public class Base64Decoder extends MessageToMessageDecoder<ByteBuf, ByteBuf> {
} }
@Override @Override
public ByteBuf decode(ChannelHandlerContext ctx, ByteBuf msg) throws Exception { protected ByteBuf decode(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
return Base64.decode(msg, msg.readerIndex(), msg.readableBytes(), dialect); return Base64.decode(msg, msg.readerIndex(), msg.readableBytes(), dialect);
} }
} }

View File

@ -65,7 +65,7 @@ public class Base64Encoder extends MessageToMessageEncoder<ByteBuf, ByteBuf> {
} }
@Override @Override
public ByteBuf encode(ChannelHandlerContext ctx, protected ByteBuf encode(ChannelHandlerContext ctx,
ByteBuf msg) throws Exception { ByteBuf msg) throws Exception {
return Base64.encode(msg, msg.readerIndex(), msg.readableBytes(), breakLines, dialect); return Base64.encode(msg, msg.readerIndex(), msg.readableBytes(), breakLines, dialect);
} }

View File

@ -53,7 +53,7 @@ public class ByteArrayDecoder extends MessageToMessageDecoder<ByteBuf, byte[]> {
} }
@Override @Override
public byte[] decode(ChannelHandlerContext ctx, ByteBuf msg) throws Exception { protected byte[] decode(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
byte[] array; byte[] array;
if (msg.hasArray()) { if (msg.hasArray()) {
if (msg.arrayOffset() == 0 && msg.readableBytes() == msg.capacity()) { if (msg.arrayOffset() == 0 && msg.readableBytes() == msg.capacity()) {

View File

@ -60,7 +60,7 @@ public class ByteArrayEncoder extends MessageToMessageEncoder<byte[], ByteBuf> {
} }
@Override @Override
public ByteBuf encode(ChannelHandlerContext ctx, byte[] msg) throws Exception { protected ByteBuf encode(ChannelHandlerContext ctx, byte[] msg) throws Exception {
if (msg.length == 0) { if (msg.length == 0) {
return null; return null;
} }

View File

@ -81,7 +81,7 @@ public class JZlibDecoder extends ZlibDecoder {
} }
@Override @Override
public void decode( protected void decode(
ChannelHandlerContext ctx, ChannelHandlerContext ctx,
ByteBuf in, ByteBuf out) throws Exception { ByteBuf in, ByteBuf out) throws Exception {

View File

@ -265,7 +265,7 @@ public class JZlibEncoder extends ZlibEncoder {
} }
@Override @Override
public void encode(ChannelHandlerContext ctx, protected void encode(ChannelHandlerContext ctx,
ByteBuf in, ByteBuf out) throws Exception { ByteBuf in, ByteBuf out) throws Exception {
if (finished.get()) { if (finished.get()) {
return; return;

View File

@ -177,7 +177,7 @@ public class JdkZlibEncoder extends ZlibEncoder {
} }
@Override @Override
public void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception { protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
if (finished.get()) { if (finished.get()) {
out.writeBytes(in); out.writeBytes(in);
in.discardReadBytes(); in.discardReadBytes();

View File

@ -69,7 +69,7 @@ public class SnappyFramedDecoder extends ByteToByteDecoder {
} }
@Override @Override
public void decode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception { protected void decode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
if (!in.readable()) { if (!in.readable()) {
return; return;
} }

View File

@ -46,7 +46,7 @@ public class SnappyFramedEncoder extends ByteToByteEncoder {
private boolean started; private boolean started;
@Override @Override
public void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception { protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
if (!in.readable()) { if (!in.readable()) {
return; return;
} }

View File

@ -54,7 +54,7 @@ public class CompatibleMarshallingDecoder extends ReplayingDecoder<Object, Void>
} }
@Override @Override
public Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception { protected Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
if (discardingTooLongFrame) { if (discardingTooLongFrame) {
buffer.skipBytes(actualReadableBytes()); buffer.skipBytes(actualReadableBytes());
checkpoint(); checkpoint();
@ -82,7 +82,7 @@ public class CompatibleMarshallingDecoder extends ReplayingDecoder<Object, Void>
} }
@Override @Override
public Object decodeLast(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception { protected Object decodeLast(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
switch (buffer.readableBytes()) { switch (buffer.readableBytes()) {
case 0: case 0:
return null; return null;

View File

@ -48,7 +48,7 @@ public class CompatibleMarshallingEncoder extends MessageToByteEncoder<Object> {
} }
@Override @Override
public void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception { protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
Marshaller marshaller = provider.getMarshaller(ctx); Marshaller marshaller = provider.getMarshaller(ctx);
marshaller.start(new ChannelBufferByteOutput(out)); marshaller.start(new ChannelBufferByteOutput(out));
marshaller.writeObject(msg); marshaller.writeObject(msg);

View File

@ -59,7 +59,7 @@ public class MarshallingDecoder extends LengthFieldBasedFrameDecoder {
} }
@Override @Override
public Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception { protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
ByteBuf frame = (ByteBuf) super.decode(ctx, in); ByteBuf frame = (ByteBuf) super.decode(ctx, in);
if (frame == null) { if (frame == null) {
return null; return null;

View File

@ -50,7 +50,7 @@ public class MarshallingEncoder extends MessageToByteEncoder<Object> {
} }
@Override @Override
public void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception { protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
Marshaller marshaller = provider.getMarshaller(ctx); Marshaller marshaller = provider.getMarshaller(ctx);
int lengthPos = out.writerIndex(); int lengthPos = out.writerIndex();
out.writeBytes(LENGTH_PLACEHOLDER); out.writeBytes(LENGTH_PLACEHOLDER);

View File

@ -84,7 +84,7 @@ public class ProtobufDecoder extends MessageToMessageDecoder<ByteBuf, MessageLit
} }
@Override @Override
public MessageLite decode(ChannelHandlerContext ctx, ByteBuf msg) throws Exception { protected MessageLite decode(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
if (msg.hasArray()) { if (msg.hasArray()) {
final int offset = msg.readerIndex(); final int offset = msg.readerIndex();
if (extensionRegistry == null) { if (extensionRegistry == null) {

View File

@ -63,7 +63,7 @@ public class ProtobufEncoder extends MessageToMessageEncoder<Object, ByteBuf> {
} }
@Override @Override
public ByteBuf encode(ChannelHandlerContext ctx, Object msg) throws Exception { protected ByteBuf encode(ChannelHandlerContext ctx, Object msg) throws Exception {
if (msg instanceof MessageLite) { if (msg instanceof MessageLite) {
return wrappedBuffer(((MessageLite) msg).toByteArray()); return wrappedBuffer(((MessageLite) msg).toByteArray());
} }

View File

@ -43,7 +43,7 @@ public class ProtobufVarint32FrameDecoder extends ByteToMessageDecoder<Object> {
// (just like LengthFieldBasedFrameDecoder) // (just like LengthFieldBasedFrameDecoder)
@Override @Override
public Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception { protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
in.markReaderIndex(); in.markReaderIndex();
final byte[] buf = new byte[5]; final byte[] buf = new byte[5];
for (int i = 0; i < buf.length; i ++) { for (int i = 0; i < buf.length; i ++) {

View File

@ -48,7 +48,7 @@ public class ProtobufVarint32LengthFieldPrepender extends MessageToByteEncoder<B
} }
@Override @Override
public void encode( protected void encode(
ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out) throws Exception { ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out) throws Exception {
int bodyLen = msg.readableBytes(); int bodyLen = msg.readableBytes();
int headerLen = CodedOutputStream.computeRawVarint32Size(bodyLen); int headerLen = CodedOutputStream.computeRawVarint32Size(bodyLen);

View File

@ -44,7 +44,7 @@ public class SctpInboundByteStreamHandler extends ChannelInboundMessageHandlerAd
} }
@Override @Override
public void messageReceived(ChannelHandlerContext ctx, SctpMessage msg) throws Exception { protected void messageReceived(ChannelHandlerContext ctx, SctpMessage msg) throws Exception {
if (!isDecodable(msg)) { if (!isDecodable(msg)) {
ctx.nextInboundMessageBuffer().add(msg); ctx.nextInboundMessageBuffer().add(msg);
ctx.fireInboundBufferUpdated(); ctx.fireInboundBufferUpdated();

View File

@ -29,7 +29,7 @@ public class SctpMessageCompletionHandler extends ChannelInboundMessageHandlerAd
private final Map<Integer, ByteBuf> fragments = new HashMap<Integer, ByteBuf>(); private final Map<Integer, ByteBuf> fragments = new HashMap<Integer, ByteBuf>();
@Override @Override
public void messageReceived(ChannelHandlerContext ctx, SctpMessage msg) throws Exception { protected void messageReceived(ChannelHandlerContext ctx, SctpMessage msg) throws Exception {
final ByteBuf byteBuf = msg.getPayloadBuffer(); final ByteBuf byteBuf = msg.getPayloadBuffer();
final int protocolIdentifier = msg.getProtocolIdentifier(); final int protocolIdentifier = msg.getProtocolIdentifier();

View File

@ -78,7 +78,7 @@ public class CompatibleObjectEncoder extends MessageToByteEncoder<Object> {
} }
@Override @Override
public void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception { protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
Attribute<ObjectOutputStream> oosAttr = ctx.attr(OOS); Attribute<ObjectOutputStream> oosAttr = ctx.attr(OOS);
ObjectOutputStream oos = oosAttr.get(); ObjectOutputStream oos = oosAttr.get();
if (oos == null) { if (oos == null) {

View File

@ -66,7 +66,7 @@ public class ObjectDecoder extends LengthFieldBasedFrameDecoder {
} }
@Override @Override
public Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception { protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
ByteBuf frame = (ByteBuf) super.decode(ctx, in); ByteBuf frame = (ByteBuf) super.decode(ctx, in);
if (frame == null) { if (frame == null) {
return null; return null;

View File

@ -44,7 +44,7 @@ public class ObjectEncoder extends MessageToByteEncoder<Object> {
} }
@Override @Override
public void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception { protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
int startIdx = out.writerIndex(); int startIdx = out.writerIndex();
ByteBufOutputStream bout = new ByteBufOutputStream(out); ByteBufOutputStream bout = new ByteBufOutputStream(out);

View File

@ -77,7 +77,7 @@ public class StringDecoder extends MessageToMessageDecoder<ByteBuf, String> {
} }
@Override @Override
public String decode(ChannelHandlerContext ctx, ByteBuf msg) throws Exception { protected String decode(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
return msg.toString(charset); return msg.toString(charset);
} }
} }

View File

@ -73,7 +73,7 @@ public class StringEncoder extends MessageToMessageEncoder<CharSequence, ByteBuf
} }
@Override @Override
public ByteBuf encode(ChannelHandlerContext ctx, CharSequence msg) throws Exception { protected ByteBuf encode(ChannelHandlerContext ctx, CharSequence msg) throws Exception {
return Unpooled.copiedBuffer(msg, charset); return Unpooled.copiedBuffer(msg, charset);
} }
} }

View File

@ -53,5 +53,5 @@ public abstract class ChannelInboundByteHandlerAdapter
* with the data at this point is up to the implementation. * with the data at this point is up to the implementation.
* Implementations may choose to read it or just let it in the buffer to read it later. * Implementations may choose to read it or just let it in the buffer to read it later.
*/ */
public abstract void inboundBufferUpdated(ChannelHandlerContext ctx, ByteBuf in) throws Exception; protected abstract void inboundBufferUpdated(ChannelHandlerContext ctx, ByteBuf in) throws Exception;
} }

View File

@ -119,7 +119,7 @@ public abstract class ChannelInboundMessageHandlerAdapter<I>
* special handling. * special handling.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public boolean beginMessageReceived(ChannelHandlerContext ctx) throws Exception { protected boolean beginMessageReceived(ChannelHandlerContext ctx) throws Exception {
return true; return true;
} }
@ -130,7 +130,7 @@ public abstract class ChannelInboundMessageHandlerAdapter<I>
* @param msg the message to handle * @param msg the message to handle
* @throws Exception thrown when an error accour * @throws Exception thrown when an error accour
*/ */
public abstract void messageReceived(ChannelHandlerContext ctx, I msg) throws Exception; protected abstract void messageReceived(ChannelHandlerContext ctx, I msg) throws Exception;
/** /**
* Is called after all messages of the {@link MessageBuf} was consumed. * Is called after all messages of the {@link MessageBuf} was consumed.
@ -141,7 +141,7 @@ public abstract class ChannelInboundMessageHandlerAdapter<I>
* @throws Exception thrown when an error accour * @throws Exception thrown when an error accour
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public void endMessageReceived(ChannelHandlerContext ctx) throws Exception { protected void endMessageReceived(ChannelHandlerContext ctx) throws Exception {
// NOOP // NOOP
} }
} }