Examples of nioBufferCount()


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

    {
        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();
    }
View Full Code Here

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

    protected int doWriteMessages(MessageBuf<Object> buf, boolean lastSpin) throws Exception {
        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.nioBufferCount()

                try {
                    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.nioBufferCount()

    protected int doWriteMessages(MessageBuf<Object> buf, boolean lastSpin) throws Exception {
        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.nioBufferCount()

                ByteBuf byteBuf = pipeline().inboundByteBuffer();
                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 {
View Full Code Here

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

        final ByteBuf byteBuf = message.data();

        final int messageSize = byteBuf.readableBytes();

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

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

        final ByteBuf byteBuf = message.content();

        final int messageSize = byteBuf.readableBytes();

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

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

        if (dataLen == 0) {
            return true;
        }

        ByteBufAllocator alloc = alloc();
        boolean needsCopy = data.nioBufferCount() != 1;
        if (!needsCopy) {
            if (!data.isDirect() && alloc.isDirectBufferPooled()) {
                needsCopy = true;
            }
        }
View Full Code Here

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

    @Override
    protected final Object filterOutboundMessage(Object msg) throws Exception {
        if (msg instanceof SctpMessage) {
            SctpMessage m = (SctpMessage) msg;
            ByteBuf buf = m.content();
            if (buf.isDirect() && buf.nioBufferCount() == 1) {
                return m;
            }

            return new SctpMessage(m.protocolIdentifier(), m.streamIdentifier(), newDirectBuffer(m, buf));
        }
View Full Code Here

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

                ByteBuf data = packet.content();
                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
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.