2012-06-04 22:31:44 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2012 The Netty Project
|
|
|
|
*
|
|
|
|
* The Netty Project licenses this file to you under the Apache License,
|
|
|
|
* version 2.0 (the "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at:
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
2012-05-23 20:42:10 +02:00
|
|
|
package io.netty.channel;
|
|
|
|
|
2012-06-10 04:08:43 +02:00
|
|
|
import io.netty.buffer.ByteBuf;
|
2012-06-11 10:02:00 +02:00
|
|
|
import io.netty.buffer.Unpooled;
|
2012-05-31 18:03:31 +02:00
|
|
|
|
2012-05-23 20:42:10 +02:00
|
|
|
|
2012-06-10 05:22:32 +02:00
|
|
|
public abstract class ChannelInboundByteHandlerAdapter
|
|
|
|
extends ChannelInboundHandlerAdapter implements ChannelInboundByteHandler {
|
2012-06-07 10:25:15 +02:00
|
|
|
|
2012-05-23 20:42:10 +02:00
|
|
|
@Override
|
2012-06-10 05:22:32 +02:00
|
|
|
public ByteBuf newInboundBuffer(ChannelHandlerContext ctx) throws Exception {
|
2012-07-19 13:23:55 +02:00
|
|
|
return Unpooled.buffer();
|
2012-05-23 20:42:10 +02:00
|
|
|
}
|
2012-05-31 18:03:31 +02:00
|
|
|
|
|
|
|
@Override
|
2012-06-10 03:48:11 +02:00
|
|
|
public final void inboundBufferUpdated(ChannelHandlerContext ctx) throws Exception {
|
2012-06-10 04:08:43 +02:00
|
|
|
ByteBuf in = ctx.inboundByteBuffer();
|
2012-06-10 03:48:11 +02:00
|
|
|
try {
|
|
|
|
inboundBufferUpdated(ctx, in);
|
|
|
|
} finally {
|
|
|
|
if (!in.readable()) {
|
|
|
|
in.discardReadBytes();
|
|
|
|
}
|
|
|
|
}
|
2012-05-31 18:03:31 +02:00
|
|
|
}
|
|
|
|
|
2012-06-10 04:08:43 +02:00
|
|
|
public abstract void inboundBufferUpdated(ChannelHandlerContext ctx, ByteBuf in) throws Exception;
|
2012-05-23 20:42:10 +02:00
|
|
|
}
|