Examples of nioBuffer()


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

            frame = (ByteBuf) super.decode(ctx, in);
            if (null == frame) {
                return null;
            }

            ByteBuffer byteBuffer = frame.nioBuffer();

            return RemotingCommand.decode(byteBuffer);
        }
        catch (Exception e) {
            log.error("decode exception, " + RemotingHelper.parseChannelRemoteAddr(ctx.channel()), e);
View Full Code Here

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

        int length = cb.readInt();
        if (length < 0)
            return null;
        ByteBuf slice = cb.readSlice(length);
        if (slice.nioBufferCount() > 0)
            return slice.nioBuffer();
        else
            return Unpooled.copiedBuffer(slice).nioBuffer();
    }

    public static void writeValue(byte[] bytes, ByteBuf cb)
View Full Code Here

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

    protected int doReadMessages(MessageBuf<Object> buf) throws Exception {
        SctpChannel ch = javaChannel();
        ByteBuf buffer = alloc().directBuffer(config().getReceiveBufferSize());
        boolean free = true;
        try {
            ByteBuffer data = buffer.nioBuffer(buffer.writerIndex(), buffer.writableBytes());
            MessageInfo messageInfo = ch.receive(data, null, notificationHandler);
            if (messageInfo == null) {
                return 0;
            }
View Full Code Here

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

        SctpMessage packet = (SctpMessage) buf.peek();
        ByteBuf data = packet.data();
        int dataLen = data.readableBytes();
        ByteBuffer nioData;
        if (data.nioBufferCount() == 1) {
            nioData = data.nioBuffer();
        } else {
            nioData = ByteBuffer.allocate(dataLen);
            data.getBytes(data.readerIndex(), nioData);
            nioData.flip();
        }
View Full Code Here

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

            for (SelectionKey ignored : reableKeys) {
                ByteBuf buffer = alloc().directBuffer(config().getReceiveBufferSize());
                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

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

    protected int doReadMessages(MessageBuf<Object> buf) throws Exception {
        DatagramChannel ch = javaChannel();
        ByteBuf buffer = alloc().directBuffer(config().getReceivePacketSize());
        boolean free = true;
        try {
            ByteBuffer data = buffer.nioBuffer(buffer.writerIndex(), buffer.writableBytes());

            InetSocketAddress remoteAddress = (InetSocketAddress) ch.receive(data);
            if (remoteAddress == null) {
                return 0;
            }
View Full Code Here

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

                    ByteBuf data = packet.data();
                    int dataLen = data.readableBytes();
                    ByteBuffer nioData;

                    if (data.nioBufferCount() != -1) {
                        nioData = data.nioBuffer();
                    } else {
                        nioData = ByteBuffer.allocate(dataLen);
                        data.getBytes(data.readerIndex(), nioData);
                        nioData.flip();
                    }
View Full Code Here

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

        DatagramPacket packet = (DatagramPacket) buf.peek();
        ByteBuf data = packet.data();
        int dataLen = data.readableBytes();
        ByteBuffer nioData;
        if (data.nioBufferCount() == 1) {
            nioData = data.nioBuffer();
        } else {
            nioData = ByteBuffer.allocate(dataLen);
            data.getBytes(data.readerIndex(), nioData);
            nioData.flip();
        }
View Full Code Here

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

                expandReadBuffer(byteBuf);

                readInProgress = true;
                if (byteBuf.nioBufferCount() == 1) {
                    // Get a ByteBuffer view on the ByteBuf
                    ByteBuffer buffer = byteBuf.nioBuffer(byteBuf.writerIndex(), byteBuf.writableBytes());
                    javaChannel().read(
                            buffer, config.getReadTimeout(), TimeUnit.MILLISECONDS, this, READ_HANDLER);
                } else {
                    ByteBuffer[] buffers = byteBuf.nioBuffers(byteBuf.writerIndex(), byteBuf.writableBytes());
                    if (buffers.length == 1) {
View Full Code Here

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

        final int messageSize = byteBuf.readableBytes();

        final long writtenBytes;
        if (byteBuf.nioBufferCount() == 1) {
            writtenBytes = javaChannel().write(byteBuf.nioBuffer());
        } else {
            writtenBytes = javaChannel().write(byteBuf.nioBuffers());
        }

        final SelectionKey key = selectionKey();
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.