Package io.netty.buffer

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


                             ? 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(header);
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(header);
            results.add(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

        ByteBuf buf = buffer;
        if (!binary) {
            buf = allocateBuffer(allocator);
        }
        byte type = toChar(packet.getType().getValue());
        buf.writeByte(type);

        switch (packet.getType()) {

            case PONG: {
                buf.writeBytes(packet.getData().toString().getBytes(CharsetUtil.UTF_8));
View Full Code Here

                break;
            }

            case MESSAGE: {
                byte subType = toChar(packet.getSubType().getValue());
                buf.writeByte(subType);

                if (packet.getSubType() == PacketType.CONNECT) {
                    if (!packet.getNsp().isEmpty()) {
                        buf.writeBytes(packet.getNsp().getBytes(CharsetUtil.UTF_8));
                    }
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.