Package io.netty.buffer

Examples of io.netty.buffer.ByteBuf.writerIndex()


                        if (remoteAddress == null) {
                            break;
                        }

                        int readBytes = remoteAddress.receivedAmount;
                        data.writerIndex(data.writerIndex() + readBytes);
                        allocHandle.record(readBytes);
                        readPending = false;
                        pipeline.fireChannelRead(
                                new DatagramPacket(data, (InetSocketAddress) localAddress(), remoteAddress));
                        data = null;
View Full Code Here


                        if (remoteAddress == null) {
                            break;
                        }

                        int readBytes = remoteAddress.receivedAmount;
                        data.writerIndex(data.writerIndex() + readBytes);
                        allocHandle.record(readBytes);
                        readPending = false;
                        pipeline.fireChannelRead(
                                new DatagramPacket(data, (InetSocketAddress) localAddress(), remoteAddress));
                        data = null;
View Full Code Here

            this.allocHandle = allocHandle = config.getRecvByteBufAllocator().newHandle();
        }
        ByteBuf data = allocHandle.allocate(config.getAllocator());
        boolean free = true;
        try {
            ByteBuffer nioData = data.internalNioBuffer(data.writerIndex(), data.writableBytes());
            int pos = nioData.position();
            InetSocketAddress remoteAddress = (InetSocketAddress) ch.receive(nioData);
            if (remoteAddress == null) {
                return 0;
            }
View Full Code Here

            if (remoteAddress == null) {
                return 0;
            }

            int readBytes = nioData.position() - pos;
            data.writerIndex(data.writerIndex() + readBytes);
            allocHandle.record(readBytes);

            buf.add(new DatagramPacket(data, localAddress(), remoteAddress));
            free = false;
            return 1;
View Full Code Here

            if (remoteAddress == null) {
                return 0;
            }

            int readBytes = nioData.position() - pos;
            data.writerIndex(data.writerIndex() + readBytes);
            allocHandle.record(readBytes);

            buf.add(new DatagramPacket(data, localAddress(), remoteAddress));
            free = false;
            return 1;
View Full Code Here

            this.allocHandle = allocHandle = config().getRecvByteBufAllocator().newHandle();
        }
        ByteBuf buffer = allocHandle.allocate(config().getAllocator());
        boolean free = true;
        try {
            ByteBuffer data = buffer.internalNioBuffer(buffer.writerIndex(), buffer.writableBytes());
            int pos = data.position();

            MessageInfo messageInfo = ch.receive(data, null, notificationHandler);
            if (messageInfo == null) {
                return 0;
View Full Code Here

            MessageInfo messageInfo = ch.receive(data, null, notificationHandler);
            if (messageInfo == null) {
                return 0;
            }
            buf.add(new SctpMessage(messageInfo, buffer.writerIndex(buffer.writerIndex() + data.position() - pos)));
            free = false;
            return 1;
        } catch (Throwable cause) {
            PlatformDependent.throwException(cause);
            return -1;
View Full Code Here

            MessageInfo messageInfo = ch.receive(data, null, notificationHandler);
            if (messageInfo == null) {
                return 0;
            }
            buf.add(new SctpMessage(messageInfo, buffer.writerIndex(buffer.writerIndex() + data.position() - pos)));
            free = false;
            return 1;
        } catch (Throwable cause) {
            PlatformDependent.throwException(cause);
            return -1;
View Full Code Here

                }
                ByteBuf buffer = allocHandle.allocate(config().getAllocator());
                boolean free = true;

                try {
                    ByteBuffer data = buffer.nioBuffer(buffer.writerIndex(), buffer.writableBytes());
                    MessageInfo messageInfo = ch.receive(data, null, notificationHandler);
                    if (messageInfo == null) {
                        return readMessages;
                    }
View Full Code Here

                    if (messageInfo == null) {
                        return readMessages;
                    }

                    data.flip();
                    msgs.add(new SctpMessage(messageInfo, buffer.writerIndex(buffer.writerIndex() + data.remaining())));
                    free = false;
                    readMessages ++;
                } catch (Throwable cause) {
                    PlatformDependent.throwException(cause);
                finally {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.