Package io.netty.buffer

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


        writePaddingLength(padding, frame);

        frame.writeBytes(fragment);

        // Write out the padding, if any.
        frame.writeZero(padding);
        return frame;
    }

    /**
     * Writes the padding length field to the output buffer.
View Full Code Here


            // Write the data.
            out.writeBytes(data, data.readerIndex(), data.readableBytes());

            // Write the required padding.
            out.writeZero(padding);
            return ctx.write(out, promise);
        } catch (RuntimeException e) {
            return promise.setFailure(e);
        } finally {
            data.release();
View Full Code Here

            // Write the first fragment.
            firstFrame.writeBytes(fragment);

            // Write out the padding, if any.
            firstFrame.writeZero(padding);

            if (headerBlock.readableBytes() == 0) {
                return ctx.write(firstFrame, promise);
            }
View Full Code Here

            // Write the first fragment.
            firstFrame.writeBytes(fragment);

            // Write out the padding, if any.
            firstFrame.writeZero(padding);

            if (flags.endOfHeaders()) {
                return ctx.write(firstFrame, promise);
            }
View Full Code Here

        final String repeatedData = "0123456789";
        final ByteBuf buffer = Unpooled.buffer(size + padding);
        for (int index = 0; index < size; ++index) {
            buffer.writeByte(repeatedData.charAt(index % repeatedData.length()));
        }
        buffer.writeZero(padding);
        return buffer;
    }

    private static void manualSafeRelease(ByteBuf data) {
        while (data.refCnt() > 0) { // Manually release just to be safe if the test fails
View Full Code Here

            // Write the data.
            out.writeBytes(data, data.readerIndex(), data.readableBytes());

            // Write the required padding.
            out.writeZero(padding);
            return ctx.write(out, promise);
        } catch (RuntimeException e) {
            return promise.setFailure(e);
        } finally {
            data.release();
View Full Code Here

            // Write the first fragment.
            firstFrame.writeBytes(fragment);

            // Write out the padding, if any.
            firstFrame.writeZero(padding);

            if (headerBlock.readableBytes() == 0) {
                return ctx.write(firstFrame, promise);
            }
View Full Code Here

            // Write the first fragment.
            firstFrame.writeBytes(fragment);

            // Write out the padding, if any.
            firstFrame.writeZero(padding);

            if (flags.endOfHeaders()) {
                return ctx.write(firstFrame, promise);
            }
View Full Code Here

        writePaddingLength(padding, frame);

        frame.writeBytes(fragment);

        // Write out the padding, if any.
        frame.writeZero(padding);
        return frame;
    }

    /**
     * Writes the padding length field to the output buffer.
View Full Code Here

        ByteBufUtils.writeVarShort(buf, 32766);
        assertArrayEquals("Two byte short written", new byte[] { 127, -2, 0}, buf.array());
        assertEquals("Two byte short written", 2, buf.readableBytes());

        buf.clear();
        buf.writeZero(3);
        buf.clear();

        buf.writeShort(32766);
        assertArrayEquals("Two byte short written", new byte[] { 127, -2, 0}, buf.array());
        int val = ByteBufUtils.readVarShort(buf);
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.