Package io.netty.buffer

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


        public void encode(ChannelHandlerContext ctx, Frame frame, List results)
        throws IOException
        {
            ByteBuf header = Unpooled.buffer(Frame.Header.LENGTH);
            Message.Type type = frame.header.type;
            header.writeByte(type.direction.addToVersion(frame.header.version));
            header.writeByte(Header.Flag.serialize(frame.header.flags));
            header.writeByte(frame.header.streamId);
            header.writeByte(type.opcode);
            header.writeInt(frame.body.readableBytes());
View Full Code Here


        throws IOException
        {
            ByteBuf header = Unpooled.buffer(Frame.Header.LENGTH);
            Message.Type type = frame.header.type;
            header.writeByte(type.direction.addToVersion(frame.header.version));
            header.writeByte(Header.Flag.serialize(frame.header.flags));
            header.writeByte(frame.header.streamId);
            header.writeByte(type.opcode);
            header.writeInt(frame.body.readableBytes());

            results.add(Unpooled.wrappedBuffer(header, frame.body));
View Full Code Here

        {
            ByteBuf header = Unpooled.buffer(Frame.Header.LENGTH);
            Message.Type type = frame.header.type;
            header.writeByte(type.direction.addToVersion(frame.header.version));
            header.writeByte(Header.Flag.serialize(frame.header.flags));
            header.writeByte(frame.header.streamId);
            header.writeByte(type.opcode);
            header.writeInt(frame.body.readableBytes());

            results.add(Unpooled.wrappedBuffer(header, frame.body));
        }
View Full Code Here

            ByteBuf header = Unpooled.buffer(Frame.Header.LENGTH);
            Message.Type type = frame.header.type;
            header.writeByte(type.direction.addToVersion(frame.header.version));
            header.writeByte(Header.Flag.serialize(frame.header.flags));
            header.writeByte(frame.header.streamId);
            header.writeByte(type.opcode);
            header.writeInt(frame.body.readableBytes());

            results.add(Unpooled.wrappedBuffer(header, frame.body));
        }
    }
View Full Code Here

                             ? Header.MODERN_LENGTH
                             : Header.LEGACY_LENGTH;
            ByteBuf header = CBUtil.allocator.buffer(headerLength);

            Message.Type type = frame.header.type;
            header.writeByte(type.direction.addToVersion(frame.header.version));
            header.writeByte(Header.Flag.serialize(frame.header.flags));

            if (frame.header.version >= Server.VERSION_3)
                header.writeShort(frame.header.streamId);
            else
View Full Code Here

                             : Header.LEGACY_LENGTH;
            ByteBuf header = CBUtil.allocator.buffer(headerLength);

            Message.Type type = frame.header.type;
            header.writeByte(type.direction.addToVersion(frame.header.version));
            header.writeByte(Header.Flag.serialize(frame.header.flags));

            if (frame.header.version >= Server.VERSION_3)
                header.writeShort(frame.header.streamId);
            else
                header.writeByte(frame.header.streamId);
View Full Code Here

            header.writeByte(Header.Flag.serialize(frame.header.flags));

            if (frame.header.version >= Server.VERSION_3)
                header.writeShort(frame.header.streamId);
            else
                header.writeByte(frame.header.streamId);

            header.writeByte(type.opcode);
            header.writeInt(frame.body.readableBytes());

            results.add(Unpooled.wrappedBuffer(header, frame.body));
View Full Code Here

            if (frame.header.version >= Server.VERSION_3)
                header.writeShort(frame.header.streamId);
            else
                header.writeByte(frame.header.streamId);

            header.writeByte(type.opcode);
            header.writeInt(frame.body.readableBytes());

            results.add(Unpooled.wrappedBuffer(header, frame.body));
        }
    }
View Full Code Here

    }

    public static ByteBuf generateContent() {
        final ByteBuf buf = Unpooled.buffer(CONTENT_SIZE);
        for (int i = 0; i < CONTENT_SIZE; i++) {
            buf.writeByte('h');
        }
        return buf;
    }

    @Override
View Full Code Here

    }

    private static ByteBuf generateContent(final List<String> messages) {
        final JsonStringEncoder jsonEndocder = new JsonStringEncoder();
        final ByteBuf content = Unpooled.buffer();
        content.writeByte('a').writeByte('[');
        final int size = messages.size();
        for (int i = 0; i < size; i++) {
            content.writeByte('"');
            final String element = messages.get(i);
            if (element == null) {
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.