Examples of ensureWritable()


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

        ByteBuf compressed = alloc.heapBuffer(len);
        boolean release = true;
        try {
            while (compressInto(compressed)) {
                // Although unlikely, it's possible that the compressed size is larger than the decompressed size
                compressed.ensureWritable(compressed.capacity() << 1);
            }
            release = false;
            return compressed;
        } finally {
            if (release) {
View Full Code Here

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

                } else {
                    final int writerIndex = byteBuf.writerIndex();
                    if (writerIndex + available > maxCapacity) {
                        byteBuf.capacity(maxCapacity);
                    } else {
                        byteBuf.ensureWritable(available);
                    }
                }
            }
        } catch (Throwable t) {
            if (read) {
View Full Code Here

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

                    } else {
                        final int writerIndex = byteBuf.writerIndex();
                        if (writerIndex + available > maxCapacity) {
                            byteBuf.capacity(maxCapacity);
                        } else {
                            byteBuf.ensureWritable(available);
                        }
                    }
                }

                if (totalReadAmount >= Integer.MAX_VALUE - localReadAmount) {
View Full Code Here

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

        final ByteBuf buf = this.buf;
        final int nameLen = name.length();
        final int valueLen = value.length();
        final int entryLen = nameLen + valueLen + 4;
        int offset = buf.writerIndex();
        buf.ensureWritable(entryLen);
        writeAscii(buf, offset, name, nameLen);
        offset += nameLen;
        buf.setByte(offset ++, ':');
        buf.setByte(offset ++, ' ');
        writeAscii(buf, offset, value, valueLen);
View Full Code Here

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

        final ByteBuf buf = this.buf;
        final int nameLen = name.length();
        final int valueLen = value.length();
        final int entryLen = nameLen + valueLen + 4;
        int offset = buf.writerIndex();
        buf.ensureWritable(entryLen);
        writeAscii(buf, offset, name, nameLen);
        offset += nameLen;

        switch (separatorType) {
            case COLON:
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.