Tighten access modifier of encode/decode()

This commit is contained in:
Trustin Lee 2013-02-08 17:37:16 +09:00
parent 646cd455ea
commit 82c46180c9
17 changed files with 21 additions and 23 deletions

View File

@ -67,7 +67,7 @@ public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpMessa
}
@Override
public Object encode(ChannelHandlerContext ctx, HttpObject msg)
protected Object encode(ChannelHandlerContext ctx, HttpObject msg)
throws Exception {
if (msg instanceof HttpResponse && ((HttpResponse) msg).getStatus().code() == 100) {

View File

@ -52,7 +52,7 @@ public class WebSocket00FrameDecoder extends ReplayingDecoder<Void> {
}
@Override
public Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
// Discard all data received if closing handshake was received before.
if (receivedClosingHandshake) {
in.skipBytes(actualReadableBytes());

View File

@ -33,7 +33,7 @@ import io.netty.handler.codec.MessageToByteEncoder;
public class WebSocket00FrameEncoder extends MessageToByteEncoder<WebSocketFrame> {
@Override
public void encode(ChannelHandlerContext ctx, WebSocketFrame msg, ByteBuf out) throws Exception {
protected void encode(ChannelHandlerContext ctx, WebSocketFrame msg, ByteBuf out) throws Exception {
if (msg instanceof TextWebSocketFrame) {
// Text frame
ByteBuf data = msg.data();

View File

@ -117,8 +117,7 @@ public class WebSocket08FrameDecoder extends ReplayingDecoder<WebSocket08FrameDe
}
@Override
public Object decode(
ChannelHandlerContext ctx, ByteBuf in) throws Exception {
protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
// Discard all data received if closing handshake was received before.
if (receivedClosingHandshake) {

View File

@ -70,7 +70,7 @@ public class SpdyHttpDecoder 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 SpdySynStreamFrame) {
// HTTP requests/responses are mapped one-to-one to SPDY streams.

View File

@ -139,7 +139,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<HttpObject> {
}
@Override
public Object encode(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
protected Object encode(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
List<Object> out = new ArrayList<Object>();
if (msg instanceof HttpRequest) {

View File

@ -42,7 +42,7 @@ public class SocksAuthRequestDecoder extends ReplayingDecoder<SocksAuthRequestDe
}
@Override
public Object decode(ChannelHandlerContext ctx, ByteBuf byteBuf) throws Exception {
protected Object decode(ChannelHandlerContext ctx, ByteBuf byteBuf) throws Exception {
switch (state()) {
case CHECK_PROTOCOL_VERSION: {
version = SocksMessage.SubnegotiationVersion.fromByte(byteBuf.readByte());

View File

@ -39,7 +39,7 @@ public class SocksAuthResponseDecoder extends ReplayingDecoder<SocksAuthResponse
}
@Override
public Object decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf) throws Exception {
protected Object decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf) throws Exception {
switch (state()) {
case CHECK_PROTOCOL_VERSION: {
version = SocksMessage.SubnegotiationVersion.fromByte(byteBuf.readByte());

View File

@ -45,7 +45,7 @@ public class SocksCmdRequestDecoder extends ReplayingDecoder<SocksCmdRequestDeco
}
@Override
public Object decode(ChannelHandlerContext ctx, ByteBuf byteBuf) throws Exception {
protected Object decode(ChannelHandlerContext ctx, ByteBuf byteBuf) throws Exception {
switch (state()) {
case CHECK_PROTOCOL_VERSION: {
version = SocksMessage.ProtocolVersion.fromByte(byteBuf.readByte());

View File

@ -45,8 +45,7 @@ public class SocksCmdResponseDecoder extends ReplayingDecoder<SocksCmdResponseDe
}
@Override
public Object decode(ChannelHandlerContext ctx, ByteBuf byteBuf) throws Exception {
protected Object decode(ChannelHandlerContext ctx, ByteBuf byteBuf) throws Exception {
switch (state()) {
case CHECK_PROTOCOL_VERSION: {
version = SocksMessage.ProtocolVersion.fromByte(byteBuf.readByte());

View File

@ -43,7 +43,7 @@ public class SocksInitRequestDecoder extends ReplayingDecoder<SocksInitRequestDe
}
@Override
public Object decode(ChannelHandlerContext ctx, ByteBuf byteBuf) throws Exception {
protected Object decode(ChannelHandlerContext ctx, ByteBuf byteBuf) throws Exception {
switch (state()) {
case CHECK_PROTOCOL_VERSION: {
version = SocksMessage.ProtocolVersion.fromByte(byteBuf.readByte());

View File

@ -40,7 +40,7 @@ public class SocksInitResponseDecoder extends ReplayingDecoder<SocksInitResponse
}
@Override
public SocksResponse decode(ChannelHandlerContext ctx, ByteBuf byteBuf) throws Exception {
protected SocksResponse decode(ChannelHandlerContext ctx, ByteBuf byteBuf) throws Exception {
switch (state()) {
case CHECK_PROTOCOL_VERSION: {
version = SocksMessage.ProtocolVersion.fromByte(byteBuf.readByte());

View File

@ -58,7 +58,7 @@ public abstract class ByteToByteCodec
private final ByteToByteEncoder encoder = new ByteToByteEncoder() {
@Override
public void encode(
protected void encode(
ChannelHandlerContext ctx,
ByteBuf in, ByteBuf out) throws Exception {
ByteToByteCodec.this.encode(ctx, in, out);
@ -67,7 +67,7 @@ public abstract class ByteToByteCodec
private final ByteToByteDecoder decoder = new ByteToByteDecoder() {
@Override
public void decode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
protected void decode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
ByteToByteCodec.this.decode(ctx, in, out);
}

View File

@ -65,7 +65,7 @@ public abstract class MessageToMessageCodec<INBOUND_IN, OUTBOUND_IN>
@Override
@SuppressWarnings("unchecked")
public Object encode(ChannelHandlerContext ctx, Object msg) throws Exception {
protected Object encode(ChannelHandlerContext ctx, Object msg) throws Exception {
return MessageToMessageCodec.this.encode(ctx, (OUTBOUND_IN) msg);
}
@ -86,7 +86,7 @@ public abstract class MessageToMessageCodec<INBOUND_IN, OUTBOUND_IN>
@Override
@SuppressWarnings("unchecked")
public Object decode(ChannelHandlerContext ctx, Object msg) throws Exception {
protected Object decode(ChannelHandlerContext ctx, Object msg) throws Exception {
return MessageToMessageCodec.this.decode(ctx, (INBOUND_IN) msg);
}

View File

@ -15,15 +15,15 @@
*/
package io.netty.handler.codec;
import static org.junit.Assert.*;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufIndexFinder;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.embedded.EmbeddedByteChannel;
import org.junit.Test;
import static org.junit.Assert.*;
public class ReplayingDecoderTest {
@Test
@ -53,7 +53,7 @@ public class ReplayingDecoderTest {
}
@Override
public ByteBuf decode(ChannelHandlerContext ctx, ByteBuf in) {
protected ByteBuf decode(ChannelHandlerContext ctx, ByteBuf in) {
ByteBuf msg = in.readBytes(in.bytesBefore(ByteBufIndexFinder.LF));
in.skipBytes(1);
return msg;

View File

@ -31,7 +31,7 @@ import java.math.BigInteger;
public class BigIntegerDecoder extends ByteToMessageDecoder {
@Override
public BigInteger decode(ChannelHandlerContext ctx, ByteBuf in) {
protected BigInteger decode(ChannelHandlerContext ctx, ByteBuf in) {
// Wait until the length prefix is available.
if (in.readableBytes() < 5) {
return null;

View File

@ -29,7 +29,7 @@ import java.math.BigInteger;
public class NumberEncoder extends MessageToByteEncoder<Number> {
@Override
public void encode(ChannelHandlerContext ctx, Number msg, ByteBuf out) throws Exception {
protected void encode(ChannelHandlerContext ctx, Number msg, ByteBuf out) throws Exception {
// Convert to a BigInteger first for easier implementation.
BigInteger v;
if (msg instanceof BigInteger) {