Package io.netty.buffer

Examples of io.netty.buffer.ChannelBuffer.array()


        ChannelBuffer buf = (ChannelBuffer) msg;
        if (buf.hasArray()) {
            final int offset = buf.readerIndex();
            if (extensionRegistry == null) {
                return prototype.newBuilderForType().mergeFrom(
                        buf.array(), buf.arrayOffset() + offset, buf.readableBytes()).build();
            } else {
                return prototype.newBuilderForType().mergeFrom(
                        buf.array(), buf.arrayOffset() + offset, buf.readableBytes(), extensionRegistry).build();
            }
        } else {
View Full Code Here


            if (extensionRegistry == null) {
                return prototype.newBuilderForType().mergeFrom(
                        buf.array(), buf.arrayOffset() + offset, buf.readableBytes()).build();
            } else {
                return prototype.newBuilderForType().mergeFrom(
                        buf.array(), buf.arrayOffset() + offset, buf.readableBytes(), extensionRegistry).build();
            }
        } else {
            if (extensionRegistry == null) {
                return prototype.newBuilderForType().mergeFrom(
                        new ChannelBufferInputStream((ChannelBuffer) msg)).build();
View Full Code Here

        ChannelBuffer buf = (ChannelBuffer) msg;
        byte[] array;
        if (buf.hasArray()) {
            if (buf.arrayOffset() == 0 && buf.readableBytes() == buf.capacity()) {
                // we have no offset and the length is the same as the capacity. Its safe to reuse the array without copy it first
                array = buf.array();
            } else {
                // copy the ChannelBuffer to a byte array
                array = new byte[buf.readableBytes()];
                buf.getBytes(0, array);
            }
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.