Package io.netty.buffer

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


    }

    @Override
    protected void decode(final ChannelHandlerContext channelHandlerContext, final BinaryWebSocketFrame frame, final List<Object> objects) throws Exception {
        final ByteBuf messageBytes = frame.content();
        final byte len = messageBytes.readByte();
        if (len <= 0) {
            objects.add(RequestMessage.INVALID);
            return;
        }
View Full Code Here


                        }

                        while (buffer.readableBytes() > 0) {
                            switch (state) {
                                case WAIT_FOR_FIRST_BYTE_LENGTH:
                                    length = (buffer.readByte() & 255) << 24;
                                    state = State.WAIT_FOR_SECOND_BYTE_LENGTH;
                                    break;

                                case WAIT_FOR_SECOND_BYTE_LENGTH:
                                    length += (buffer.readByte() & 255) << 16;
View Full Code Here

                                    length = (buffer.readByte() & 255) << 24;
                                    state = State.WAIT_FOR_SECOND_BYTE_LENGTH;
                                    break;

                                case WAIT_FOR_SECOND_BYTE_LENGTH:
                                    length += (buffer.readByte() & 255) << 16;
                                    state = State.WAIT_FOR_THIRD_BYTE_LENGTH;
                                    break;

                                case WAIT_FOR_THIRD_BYTE_LENGTH:
                                    length += (buffer.readByte() & 255) << 8;
View Full Code Here

                                    length += (buffer.readByte() & 255) << 16;
                                    state = State.WAIT_FOR_THIRD_BYTE_LENGTH;
                                    break;

                                case WAIT_FOR_THIRD_BYTE_LENGTH:
                                    length += (buffer.readByte() & 255) << 8;
                                    state = State.WAIT_FOR_FOURTH_BYTE_LENGTH;
                                    break;

                                case WAIT_FOR_FOURTH_BYTE_LENGTH:
                                    length += (buffer.readByte() & 255);
View Full Code Here

                                    length += (buffer.readByte() & 255) << 8;
                                    state = State.WAIT_FOR_FOURTH_BYTE_LENGTH;
                                    break;

                                case WAIT_FOR_FOURTH_BYTE_LENGTH:
                                    length += (buffer.readByte() & 255);
                                    state = State.READING;

                                    if ((length == 0) && (buffer.readableBytes() == 0)) {
                                        ctx.writeAndFlush(new DatagramPacket(ACK.retain(1).resetReaderIndex(), message.sender()));
                                        state = State.WAIT_FOR_FIRST_BYTE_LENGTH;
View Full Code Here

            }

            while (buffer.readableBytes() > 0) {
                switch (state) {
                case WAIT_FOR_FIRST_BYTE_LENGTH:
                    length = (buffer.readByte() & 255) << 24;
                    state = State.WAIT_FOR_SECOND_BYTE_LENGTH;
                    break;

                case WAIT_FOR_SECOND_BYTE_LENGTH:
                    length += (buffer.readByte() & 255) << 16;
View Full Code Here

                    length = (buffer.readByte() & 255) << 24;
                    state = State.WAIT_FOR_SECOND_BYTE_LENGTH;
                    break;

                case WAIT_FOR_SECOND_BYTE_LENGTH:
                    length += (buffer.readByte() & 255) << 16;
                    state = State.WAIT_FOR_THIRD_BYTE_LENGTH;
                    break;

                case WAIT_FOR_THIRD_BYTE_LENGTH:
                    length += (buffer.readByte() & 255) << 8;
View Full Code Here

                    length += (buffer.readByte() & 255) << 16;
                    state = State.WAIT_FOR_THIRD_BYTE_LENGTH;
                    break;

                case WAIT_FOR_THIRD_BYTE_LENGTH:
                    length += (buffer.readByte() & 255) << 8;
                    state = State.WAIT_FOR_FOURTH_BYTE_LENGTH;
                    break;

                case WAIT_FOR_FOURTH_BYTE_LENGTH:
                    length += (buffer.readByte() & 255);
View Full Code Here

                    length += (buffer.readByte() & 255) << 8;
                    state = State.WAIT_FOR_FOURTH_BYTE_LENGTH;
                    break;

                case WAIT_FOR_FOURTH_BYTE_LENGTH:
                    length += (buffer.readByte() & 255);
                    state = State.READING;

                    if ((length == 0) && (buffer.readableBytes() == 0)) {
                        ctx.writeAndFlush(ACK.retain(1).resetReaderIndex());
                        state = State.WAIT_FOR_FIRST_BYTE_LENGTH;
View Full Code Here

          throws Exception {
        boolean handled = false;
        if (ByteBuf.class.isAssignableFrom(msg.getClass())) {
                    ByteBuf byteBuf = (ByteBuf) msg;
                    if (byteBuf.isReadable()) {
                        int protocolVersion = byteBuf.readByte();
                        if (protocolVersion != PROTOCOL_VERSION){
                          throw new RuntimeException("Unsupported protocol version: "+protocolVersion);
                        }
                        int observableNameLength = byteBuf.readByte();
                        String observableName = 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.