[#846] Tighten up visibility
This commit is contained in:
parent
5bd3648b3d
commit
852f546b5b
@ -110,7 +110,7 @@ public class HttpChunkAggregator extends MessageToMessageDecoder<HttpObject, Htt
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpMessage decode(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
|
||||
protected HttpMessage decode(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
|
||||
HttpMessage currentMessage = this.currentMessage;
|
||||
|
||||
if (msg instanceof HttpMessage) {
|
||||
|
@ -82,7 +82,7 @@ public class HttpClientCodec extends CombinedChannelHandler {
|
||||
|
||||
private final class Encoder extends HttpRequestEncoder {
|
||||
@Override
|
||||
public void encode(
|
||||
protected void encode(
|
||||
ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
|
||||
if (msg instanceof HttpRequest && !done) {
|
||||
queue.offer(((HttpRequest) msg).getMethod());
|
||||
@ -109,7 +109,7 @@ public class HttpClientCodec extends CombinedChannelHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object decode(
|
||||
protected Object decode(
|
||||
ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
|
||||
if (done) {
|
||||
return buffer.readBytes(actualReadableBytes());
|
||||
|
@ -52,7 +52,7 @@ public abstract class HttpContentDecoder extends MessageToMessageDecoder<Object,
|
||||
}
|
||||
|
||||
@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) {
|
||||
// 100-continue response must be passed through.
|
||||
return msg;
|
||||
|
@ -61,7 +61,7 @@ public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpMessa
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpMessage decode(ChannelHandlerContext ctx, HttpMessage msg)
|
||||
protected HttpMessage decode(ChannelHandlerContext ctx, HttpMessage msg)
|
||||
throws Exception {
|
||||
String acceptedEncoding = msg.getHeader(HttpHeaders.Names.ACCEPT_ENCODING);
|
||||
if (acceptedEncoding == null) {
|
||||
|
@ -168,7 +168,7 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<Object, HttpMe
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
|
||||
protected Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
|
||||
switch (state()) {
|
||||
case SKIP_CONTROL_CHARS: {
|
||||
try {
|
||||
|
@ -54,7 +54,7 @@ public abstract class HttpMessageEncoder extends MessageToByteEncoder<Object> {
|
||||
}
|
||||
|
||||
@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) {
|
||||
HttpMessage m = (HttpMessage) msg;
|
||||
HttpTransferEncoding te = m.getTransferEncoding();
|
||||
|
@ -74,7 +74,7 @@ public abstract class RtspMessageDecoder extends HttpMessageDecoder {
|
||||
}
|
||||
|
||||
@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);
|
||||
if (o != null && aggregator.writeInbound(o)) {
|
||||
return aggregator.readInbound();
|
||||
|
@ -39,7 +39,7 @@ public abstract class RtspMessageEncoder extends HttpMessageEncoder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ChannelHandlerContext ctx, Object msg,
|
||||
protected void encode(ChannelHandlerContext ctx, Object msg,
|
||||
ByteBuf out) throws Exception {
|
||||
// Ignore unrelated message types such as HttpChunk.
|
||||
if (!(msg instanceof HttpMessage)) {
|
||||
|
@ -101,7 +101,7 @@ public class SpdyFrameDecoder extends ByteToMessageDecoder<Object> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
|
||||
protected Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
|
||||
switch(state) {
|
||||
case READ_COMMON_HEADER:
|
||||
state = readCommonHeader(buffer);
|
||||
|
@ -78,7 +78,7 @@ public class SpdyFrameEncoder extends MessageToByteEncoder<Object> {
|
||||
}
|
||||
|
||||
@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) {
|
||||
|
||||
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;
|
||||
|
@ -38,7 +38,7 @@ public class SpdyHttpResponseStreamIdHandler extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpMessage encode(ChannelHandlerContext ctx, HttpMessage msg) throws Exception {
|
||||
protected HttpMessage encode(ChannelHandlerContext ctx, HttpMessage msg) throws Exception {
|
||||
Integer id = ids.poll();
|
||||
if (id != null && id.intValue() != NO_ID && !msg.containsHeader(SpdyHttpHeaders.Names.STREAM_ID)) {
|
||||
SpdyHttpHeaders.setStreamId(msg, id);
|
||||
@ -47,7 +47,7 @@ public class SpdyHttpResponseStreamIdHandler extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object decode(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
protected Object decode(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
if (msg instanceof HttpMessage) {
|
||||
boolean contains = ((HttpMessage) msg).containsHeader(SpdyHttpHeaders.Names.STREAM_ID);
|
||||
if (!contains) {
|
||||
|
@ -109,14 +109,14 @@ public abstract class ByteToByteCodec
|
||||
/**
|
||||
* @see {@link ByteToByteEncoder#encode(ChannelHandlerContext, ByteBuf, ByteBuf)}
|
||||
*/
|
||||
public abstract void encode(
|
||||
protected abstract void encode(
|
||||
ChannelHandlerContext ctx,
|
||||
ByteBuf in, ByteBuf out) throws Exception;
|
||||
|
||||
/**
|
||||
* @see {@link ByteToByteDecoder#decode(ChannelHandlerContext, ByteBuf, ByteBuf)}
|
||||
*/
|
||||
public abstract void decode(
|
||||
protected abstract void decode(
|
||||
ChannelHandlerContext ctx,
|
||||
ByteBuf in, ByteBuf out) throws Exception;
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ public abstract class ByteToByteDecoder extends ChannelInboundByteHandlerAdapter
|
||||
* @param out the {@link ByteBuf} to which the decoded data will be written
|
||||
* @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
|
||||
@ -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
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
@ -79,5 +79,5 @@ public abstract class ByteToByteEncoder extends ChannelOutboundByteHandlerAdapte
|
||||
* @param out the {@link ByteBuf} to which the decoded data will be written
|
||||
* @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;
|
||||
}
|
||||
|
@ -80,10 +80,10 @@ public abstract class ByteToMessageCodec<INBOUND_OUT, OUTBOUND_IN>
|
||||
encoder.freeOutboundBuffer(ctx, buf);
|
||||
}
|
||||
|
||||
public abstract void encode(
|
||||
protected abstract void encode(
|
||||
ChannelHandlerContext ctx,
|
||||
OUTBOUND_IN msg, ByteBuf out) throws Exception;
|
||||
|
||||
public abstract INBOUND_OUT decode(
|
||||
protected abstract INBOUND_OUT decode(
|
||||
ChannelHandlerContext ctx, ByteBuf in) throws Exception;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public abstract class ByteToMessageDecoder<O>
|
||||
* there was not enough data left in the {@link ByteBuf} to decode.
|
||||
* @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
|
||||
@ -175,7 +175,7 @@ public abstract class ByteToMessageDecoder<O>
|
||||
* By default this will just call {@link #decode(ChannelHandlerContext, ByteBuf)} but sub-classes may
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
@ -209,8 +209,9 @@ public class DelimiterBasedFrameDecoder extends ByteToMessageDecoder<Object> {
|
||||
private boolean isSubclass() {
|
||||
return getClass() != DelimiterBasedFrameDecoder.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
|
||||
protected Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
|
||||
if (lineBasedDecoder != null) {
|
||||
return lineBasedDecoder.decode(ctx, buffer);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class FixedLengthFrameDecoder extends ByteToMessageDecoder<Object> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
if (in.readableBytes() < frameLength) {
|
||||
return null;
|
||||
} else {
|
||||
|
@ -307,7 +307,7 @@ public class LengthFieldBasedFrameDecoder extends ByteToMessageDecoder<Object> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
if (discardingTooLongFrame) {
|
||||
long bytesToDiscard = this.bytesToDiscard;
|
||||
int localBytesToDiscard = (int) Math.min(bytesToDiscard, in.readableBytes());
|
||||
|
@ -95,7 +95,7 @@ public class LengthFieldPrepender extends MessageToByteEncoder<ByteBuf> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(
|
||||
protected void encode(
|
||||
ChannelHandlerContext ctx,
|
||||
ByteBuf msg, ByteBuf out) throws Exception {
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class LineBasedFrameDecoder extends ByteToMessageDecoder<ByteBuf> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
|
||||
protected ByteBuf decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
|
||||
|
||||
final int eol = findEndOfLine(buffer);
|
||||
if (eol != -1) {
|
||||
|
@ -104,5 +104,5 @@ public abstract class MessageToByteEncoder<I> extends ChannelOutboundMessageHand
|
||||
* @param out the {@link ByteBuf} into which the encoded message will be written
|
||||
* @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;
|
||||
}
|
||||
|
@ -142,6 +142,6 @@ public abstract class MessageToMessageCodec<INBOUND_IN, INBOUND_OUT, OUTBOUND_IN
|
||||
return ChannelHandlerUtil.acceptMessage(acceptedOutboundMsgTypes, msg);
|
||||
}
|
||||
|
||||
public 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 OUTBOUND_OUT encode(ChannelHandlerContext ctx, OUTBOUND_IN msg) throws Exception;
|
||||
protected abstract INBOUND_OUT decode(ChannelHandlerContext ctx, INBOUND_IN msg) throws Exception;
|
||||
}
|
||||
|
@ -121,5 +121,5 @@ public abstract class MessageToMessageDecoder<I, O>
|
||||
* needs to do some kind of aggragation
|
||||
* @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;
|
||||
}
|
||||
|
@ -111,5 +111,5 @@ public abstract class MessageToMessageEncoder<I, O> extends ChannelOutboundMessa
|
||||
* needs to do some kind of aggragation
|
||||
* @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;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class Base64Decoder extends MessageToMessageDecoder<ByteBuf, ByteBuf> {
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class Base64Encoder extends MessageToMessageEncoder<ByteBuf, ByteBuf> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf encode(ChannelHandlerContext ctx,
|
||||
protected ByteBuf encode(ChannelHandlerContext ctx,
|
||||
ByteBuf msg) throws Exception {
|
||||
return Base64.encode(msg, msg.readerIndex(), msg.readableBytes(), breakLines, dialect);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class ByteArrayDecoder extends MessageToMessageDecoder<ByteBuf, byte[]> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] decode(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
protected byte[] decode(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
byte[] array;
|
||||
if (msg.hasArray()) {
|
||||
if (msg.arrayOffset() == 0 && msg.readableBytes() == msg.capacity()) {
|
||||
|
@ -60,7 +60,7 @@ public class ByteArrayEncoder extends MessageToMessageEncoder<byte[], ByteBuf> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf encode(ChannelHandlerContext ctx, byte[] msg) throws Exception {
|
||||
protected ByteBuf encode(ChannelHandlerContext ctx, byte[] msg) throws Exception {
|
||||
if (msg.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class JZlibDecoder extends ZlibDecoder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(
|
||||
protected void decode(
|
||||
ChannelHandlerContext ctx,
|
||||
ByteBuf in, ByteBuf out) throws Exception {
|
||||
|
||||
|
@ -265,7 +265,7 @@ public class JZlibEncoder extends ZlibEncoder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ChannelHandlerContext ctx,
|
||||
protected void encode(ChannelHandlerContext ctx,
|
||||
ByteBuf in, ByteBuf out) throws Exception {
|
||||
if (finished.get()) {
|
||||
return;
|
||||
|
@ -177,7 +177,7 @@ public class JdkZlibEncoder extends ZlibEncoder {
|
||||
}
|
||||
|
||||
@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()) {
|
||||
out.writeBytes(in);
|
||||
in.discardReadBytes();
|
||||
|
@ -69,7 +69,7 @@ public class SnappyFramedDecoder extends ByteToByteDecoder {
|
||||
}
|
||||
|
||||
@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()) {
|
||||
return;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class SnappyFramedEncoder extends ByteToByteEncoder {
|
||||
private boolean started;
|
||||
|
||||
@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()) {
|
||||
return;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class CompatibleMarshallingDecoder extends ReplayingDecoder<Object, Void>
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
|
||||
protected Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
|
||||
if (discardingTooLongFrame) {
|
||||
buffer.skipBytes(actualReadableBytes());
|
||||
checkpoint();
|
||||
@ -82,7 +82,7 @@ public class CompatibleMarshallingDecoder extends ReplayingDecoder<Object, Void>
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object decodeLast(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
|
||||
protected Object decodeLast(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
|
||||
switch (buffer.readableBytes()) {
|
||||
case 0:
|
||||
return null;
|
||||
|
@ -48,7 +48,7 @@ public class CompatibleMarshallingEncoder extends MessageToByteEncoder<Object> {
|
||||
}
|
||||
|
||||
@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.start(new ChannelBufferByteOutput(out));
|
||||
marshaller.writeObject(msg);
|
||||
|
@ -59,7 +59,7 @@ public class MarshallingDecoder extends LengthFieldBasedFrameDecoder {
|
||||
}
|
||||
|
||||
@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);
|
||||
if (frame == null) {
|
||||
return null;
|
||||
|
@ -50,7 +50,7 @@ public class MarshallingEncoder extends MessageToByteEncoder<Object> {
|
||||
}
|
||||
|
||||
@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);
|
||||
int lengthPos = out.writerIndex();
|
||||
out.writeBytes(LENGTH_PLACEHOLDER);
|
||||
|
@ -84,7 +84,7 @@ public class ProtobufDecoder extends MessageToMessageDecoder<ByteBuf, MessageLit
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageLite decode(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
protected MessageLite decode(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
if (msg.hasArray()) {
|
||||
final int offset = msg.readerIndex();
|
||||
if (extensionRegistry == null) {
|
||||
|
@ -63,7 +63,7 @@ public class ProtobufEncoder extends MessageToMessageEncoder<Object, ByteBuf> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf encode(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
protected ByteBuf encode(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
if (msg instanceof MessageLite) {
|
||||
return wrappedBuffer(((MessageLite) msg).toByteArray());
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class ProtobufVarint32FrameDecoder extends ByteToMessageDecoder<Object> {
|
||||
// (just like LengthFieldBasedFrameDecoder)
|
||||
|
||||
@Override
|
||||
public Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
|
||||
in.markReaderIndex();
|
||||
final byte[] buf = new byte[5];
|
||||
for (int i = 0; i < buf.length; i ++) {
|
||||
|
@ -48,7 +48,7 @@ public class ProtobufVarint32LengthFieldPrepender extends MessageToByteEncoder<B
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(
|
||||
protected void encode(
|
||||
ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out) throws Exception {
|
||||
int bodyLen = msg.readableBytes();
|
||||
int headerLen = CodedOutputStream.computeRawVarint32Size(bodyLen);
|
||||
|
@ -44,7 +44,7 @@ public class SctpInboundByteStreamHandler extends ChannelInboundMessageHandlerAd
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageReceived(ChannelHandlerContext ctx, SctpMessage msg) throws Exception {
|
||||
protected void messageReceived(ChannelHandlerContext ctx, SctpMessage msg) throws Exception {
|
||||
if (!isDecodable(msg)) {
|
||||
ctx.nextInboundMessageBuffer().add(msg);
|
||||
ctx.fireInboundBufferUpdated();
|
||||
|
@ -29,7 +29,7 @@ public class SctpMessageCompletionHandler extends ChannelInboundMessageHandlerAd
|
||||
private final Map<Integer, ByteBuf> fragments = new HashMap<Integer, ByteBuf>();
|
||||
|
||||
@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 int protocolIdentifier = msg.getProtocolIdentifier();
|
||||
|
@ -78,7 +78,7 @@ public class CompatibleObjectEncoder extends MessageToByteEncoder<Object> {
|
||||
}
|
||||
|
||||
@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);
|
||||
ObjectOutputStream oos = oosAttr.get();
|
||||
if (oos == null) {
|
||||
|
@ -66,7 +66,7 @@ public class ObjectDecoder extends LengthFieldBasedFrameDecoder {
|
||||
}
|
||||
|
||||
@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);
|
||||
if (frame == null) {
|
||||
return null;
|
||||
|
@ -44,7 +44,7 @@ public class ObjectEncoder extends MessageToByteEncoder<Object> {
|
||||
}
|
||||
|
||||
@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();
|
||||
|
||||
ByteBufOutputStream bout = new ByteBufOutputStream(out);
|
||||
|
@ -77,7 +77,7 @@ public class StringDecoder extends MessageToMessageDecoder<ByteBuf, String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
protected String decode(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||
return msg.toString(charset);
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class StringEncoder extends MessageToMessageEncoder<CharSequence, ByteBuf
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf encode(ChannelHandlerContext ctx, CharSequence msg) throws Exception {
|
||||
protected ByteBuf encode(ChannelHandlerContext ctx, CharSequence msg) throws Exception {
|
||||
return Unpooled.copiedBuffer(msg, charset);
|
||||
}
|
||||
}
|
||||
|
@ -53,5 +53,5 @@ public abstract class ChannelInboundByteHandlerAdapter
|
||||
* 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.
|
||||
*/
|
||||
public abstract void inboundBufferUpdated(ChannelHandlerContext ctx, ByteBuf in) throws Exception;
|
||||
protected abstract void inboundBufferUpdated(ChannelHandlerContext ctx, ByteBuf in) throws Exception;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public abstract class ChannelInboundMessageHandlerAdapter<I>
|
||||
* special handling.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public boolean beginMessageReceived(ChannelHandlerContext ctx) throws Exception {
|
||||
protected boolean beginMessageReceived(ChannelHandlerContext ctx) throws Exception {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ public abstract class ChannelInboundMessageHandlerAdapter<I>
|
||||
* @param msg the message to handle
|
||||
* @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.
|
||||
@ -141,7 +141,7 @@ public abstract class ChannelInboundMessageHandlerAdapter<I>
|
||||
* @throws Exception thrown when an error accour
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public void endMessageReceived(ChannelHandlerContext ctx) throws Exception {
|
||||
protected void endMessageReceived(ChannelHandlerContext ctx) throws Exception {
|
||||
// NOOP
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user