Package io.netty.buffer

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


    int senderId = -1;
    long requestId = -1;
    int response = -1;
    try {
      senderId = buf.readInt();
      requestId = buf.readLong();
      response = buf.readByte();
    } catch (IndexOutOfBoundsException e) {
      throw new IllegalStateException(
          "channelRead: Got IndexOutOfBoundsException ", e);
    }
View Full Code Here


        if (frame == null) {
            return null;
        }
        int len = frame.readInt();
        byte type = frame.readByte();
        long msb = frame.readLong();
        long lsb = frame.readLong();
        long hash = frame.readLong();
        byte[] segment = new byte[len - 25];
        frame.getBytes(29, segment);
        Hasher hasher = Hashing.murmur3_32().newHasher();
View Full Code Here

            return null;
        }
        int len = frame.readInt();
        byte type = frame.readByte();
        long msb = frame.readLong();
        long lsb = frame.readLong();
        long hash = frame.readLong();
        byte[] segment = new byte[len - 25];
        frame.getBytes(29, segment);
        Hasher hasher = Hashing.murmur3_32().newHasher();
        long check = hasher.putBytes(segment).hash().padToLong();
View Full Code Here

        }
        int len = frame.readInt();
        byte type = frame.readByte();
        long msb = frame.readLong();
        long lsb = frame.readLong();
        long hash = frame.readLong();
        byte[] segment = new byte[len - 25];
        frame.getBytes(29, segment);
        Hasher hasher = Hashing.murmur3_32().newHasher();
        long check = hasher.putBytes(segment).hash().padToLong();
        if (hash == check) {
View Full Code Here

        Assert.assertEquals((byte) 0x08, encoded.readByte());
        Assert.assertEquals((byte) 0, encoded.readByte());
        Assert.assertEquals(0, encoded.readShort());
        Assert.assertEquals(4 + 6 + 8, encoded.readInt());
        Assert.assertEquals(request.id(), encoded.readInt());
        Assert.assertEquals(request.cas(), encoded.readLong());
        Assert.assertEquals(request.flags(), encoded.readInt());
        Assert.assertEquals(request.expires(), encoded.readInt());

        byte[] data = new byte[encoded.readableBytes()];
        encoded.readBytes(data);
View Full Code Here

                return null;/*正常处理后返回*/
            }
        }
        /*                    错误情况*/
        frame.skipBytes(1);
        this.fireProtocolError(ctx, version, frame.readLong());
        return null;
    }
    protected ByteBuf extractFrame(ChannelHandlerContext ctx, ByteBuf buffer, int index, int length) {
        return buffer.slice(index, length);
    }
View Full Code Here

  public void testDecodeLong() throws Exception {
   
    byte[] fileContent = readFromFile(13 * 8);
    ByteBuf buf = Unpooled.copiedBuffer(fileContent);
   
    long val1 = buf.readLong();
    long val2 = buf.readLong();
    long val3 = buf.readLong();
    long val4 = buf.readLong();
    long val5 = buf.readLong();
    long val6 = buf.readLong();
View Full Code Here

   
    byte[] fileContent = readFromFile(13 * 8);
    ByteBuf buf = Unpooled.copiedBuffer(fileContent);
   
    long val1 = buf.readLong();
    long val2 = buf.readLong();
    long val3 = buf.readLong();
    long val4 = buf.readLong();
    long val5 = buf.readLong();
    long val6 = buf.readLong();
    long val7 = buf.readLong();
View Full Code Here

    byte[] fileContent = readFromFile(13 * 8);
    ByteBuf buf = Unpooled.copiedBuffer(fileContent);
   
    long val1 = buf.readLong();
    long val2 = buf.readLong();
    long val3 = buf.readLong();
    long val4 = buf.readLong();
    long val5 = buf.readLong();
    long val6 = buf.readLong();
    long val7 = buf.readLong();
    long val8 = buf.readLong();
View Full Code Here

    ByteBuf buf = Unpooled.copiedBuffer(fileContent);
   
    long val1 = buf.readLong();
    long val2 = buf.readLong();
    long val3 = buf.readLong();
    long val4 = buf.readLong();
    long val5 = buf.readLong();
    long val6 = buf.readLong();
    long val7 = buf.readLong();
    long val8 = buf.readLong();
    long val9 = buf.readLong();
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.