Package org.jboss.netty.buffer

Examples of org.jboss.netty.buffer.ChannelBuffer.readByte()


                                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;
                                    state = State.WAIT_FOR_FOURTH_BYTE_LENGTH;
                                    break;
                                case WAIT_FOR_FOURTH_BYTE_LENGTH:
                                    length += (buffer.readByte() & 255);
                                    state = State.READING;
View Full Code Here


                                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);
                                    state = State.READING;
                                    if ((length == 0) && (buffer.readableBytes() == 0)) {
                                        ctx.getChannel().write(ACK.slice());
                                        state = State.WAIT_FOR_FIRST_BYTE_LENGTH;
                                    }
View Full Code Here

  @Test
  public void testControlCharacterSkipping() {
    ChannelBuffer buffer = ChannelBuffers.copiedBuffer("  TESTLINE".getBytes());
    IcapDecoderUtil.skipControlCharacters(buffer);
    assertEquals("skipping of whitespaces has not worked",'T',(char)buffer.readByte());
  }
 
  @Test
  public void testSkipControlCharacter() {
    ChannelBuffer buffer = ChannelBuffers.copiedBuffer(new byte[]{0x0001,'A'});
View Full Code Here

 
  @Test
  public void testSkipControlCharacter() {
    ChannelBuffer buffer = ChannelBuffers.copiedBuffer(new byte[]{0x0001,'A'});
    IcapDecoderUtil.skipControlCharacters(buffer);
    assertEquals("control character was not skiped",'A',buffer.readByte());
  }
 
  @Test
  public void testReadLine() {
    StringBuilder builder = new StringBuilder("REQMOD icap://icap.mimo.ch:1344/reqmod ICAP/1.0").append(new String(IcapCodecUtil.CRLF)).append("NEW LINE");
View Full Code Here

        long deviceId = buf.readUnsignedInt();
       
        if (type != MSG_CLIENT_SERIAL) {
            buf.readUnsignedShort(); // communication control
        }
        byte packetNumber = buf.readByte();

        // Send reply
        sendReply(channel, deviceId, packetNumber);

        // Parse location
View Full Code Here

            throws Exception {

        ChannelBuffer buf = (ChannelBuffer) msg;

        buf.skipBytes(2); // header
        buf.readByte(); // size

        // Zero for location messages
        buf.readByte(); // voltage
        buf.readByte(); // gsm signal
View Full Code Here

        buf.skipBytes(2); // header
        buf.readByte(); // size

        // Zero for location messages
        buf.readByte(); // voltage
        buf.readByte(); // gsm signal

        String imei = readImei(buf);
        long index = buf.readUnsignedShort();
        int type = buf.readUnsignedByte();
View Full Code Here

        buf.skipBytes(2); // header
        buf.readByte(); // size

        // Zero for location messages
        buf.readByte(); // voltage
        buf.readByte(); // gsm signal

        String imei = readImei(buf);
        long index = buf.readUnsignedShort();
        int type = buf.readUnsignedByte();
View Full Code Here

            position.setTime(time.getTime());

            // Identification
            ChannelBuffer rawId = buf.readBytes(11);
            int index = 0;
            while (rawId.readable() && rawId.readByte() != 0) {
                index += 1;
            }
            String id = rawId.toString(0, index, Charset.defaultCharset());
            try {
                position.setDeviceId(getDataManager().getDeviceByImei(id).getId());
View Full Code Here

            firstPacket = false;

            // Read IMEI
            StringBuilder imei = new StringBuilder();
            for (int i = 0; i < 8; i++) {
                int b = buf.readByte();
                if (i != 0) {
                    imei.append(b / 10);
                }
                imei.append(b % 10);
            }
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.