@Test public void testReadLong() { DynamicCompositeByteBuf compositeByteBuf = new DynamicCompositeByteBuf(); ByteBuf buf = Unpooled.buffer(8); buf.writeLong(234L); compositeByteBuf.addBuffer(buf); Assert.assertTrue(compositeByteBuf.readLong() == 234L); }
public long readLong() { checkReadableBytes0(8); ByteBuf first = buffers.peek(); int firstLen = first.readableBytes(); if (firstLen >= 8) { long res = first.readLong(); readableBytes -= 8; if (firstLen == 8) { buffers.removeFirst().release(); } return res; } else if (order() == ByteOrder.BIG_ENDIAN) { return (readInt() & 0xffffffffL) << 32 | readInt() & 0xffffffffL; } else { return readInt() & 0xFFFFFFFFL | (readInt() & 0xFFFFFFFFL) << 32; } }
DynamicCompositeByteBuf { public long readLong() { checkReadableBytes0(8); ByteBuf first = buffers.peek(); int firstLen = first.readableBytes(); if (firstLen >= 8) { long res = first.readLong(); readableBytes -= 8; if (firstLen == 8) { buffers.removeFirst().release(); } return res; } else if (order() == ByteOrder.BIG_ENDIAN) { return (readInt() & 0xffffffffL) << 32 | readInt() & 0xffffffffL; } else { return readInt() & 0xFFFFFFFFL | (readInt() & 0xFFFFFFFFL) << 32; } } }
DynamicCompositeByteBuf { public long readLong() { checkReadableBytes0(8); ByteBuf first = buffers.peek(); int firstLen = first.readableBytes(); if (firstLen >= 8) { long res = first.readLong(); readableBytes -= 8; if (firstLen == 8) { buffers.removeFirst().release(); } return res; } else if (order() == ByteOrder.BIG_ENDIAN) { return (readInt() & 0xffffffffL) << 32 | readInt() & 0xffffffffL; } else { return readInt() & 0xFFFFFFFFL | (readInt() & 0xFFFFFFFFL) << 32; } } DynamicCompositeByteBuf();  DynamicCompositeByteBuf(int capacity);  DynamicCompositeByteBuf(ByteBuf buf);  DynamicCompositeByteBuf(ByteBuf[] bufs, int offset, int len); }
DynamicCompositeByteBuf { public long readLong() { checkReadableBytes0(8); ByteBuf first = buffers.peek(); int firstLen = first.readableBytes(); if (firstLen >= 8) { long res = first.readLong(); readableBytes -= 8; if (firstLen == 8) { buffers.removeFirst().release(); } return res; } else if (order() == ByteOrder.BIG_ENDIAN) { return (readInt() & 0xffffffffL) << 32 | readInt() & 0xffffffffL; } else { return readInt() & 0xFFFFFFFFL | (readInt() & 0xFFFFFFFFL) << 32; } } DynamicCompositeByteBuf();  DynamicCompositeByteBuf(int capacity);  DynamicCompositeByteBuf(ByteBuf buf);  DynamicCompositeByteBuf(ByteBuf[] bufs, int offset, int len); int readableBytes(); boolean isEmpty(); boolean hasArray(); byte[] array(); int arrayOffset(); int readerIndex(); boolean isReadable(); ByteBuf nettyByteBuf(); void addBuffer(ByteBuf buffer); ByteBuf readRetainedSlice(int length); ByteBuf retainedSlice(int length); void skipBytes(int length); DynamicCompositeByteBuf readBytes(byte[] dst); DynamicCompositeByteBuf readBytes(byte[] dst, int dstIndex, int length); byte readByte(); short readUnsignedByte(); short readShort(); short readShortLE(); int readUnsignedShort(); int readUnsignedShortLE(); int readInt(); int readIntLE(); long readLong(); long readLongLE(); char readChar(); float readFloat(); float readFloatLE(); double readDouble(); double readDoubleLE(); ByteOrder order(); void release(); @Override String toString(); }
DynamicCompositeByteBuf { public long readLong() { checkReadableBytes0(8); ByteBuf first = buffers.peek(); int firstLen = first.readableBytes(); if (firstLen >= 8) { long res = first.readLong(); readableBytes -= 8; if (firstLen == 8) { buffers.removeFirst().release(); } return res; } else if (order() == ByteOrder.BIG_ENDIAN) { return (readInt() & 0xffffffffL) << 32 | readInt() & 0xffffffffL; } else { return readInt() & 0xFFFFFFFFL | (readInt() & 0xFFFFFFFFL) << 32; } } DynamicCompositeByteBuf();  DynamicCompositeByteBuf(int capacity);  DynamicCompositeByteBuf(ByteBuf buf);  DynamicCompositeByteBuf(ByteBuf[] bufs, int offset, int len); int readableBytes(); boolean isEmpty(); boolean hasArray(); byte[] array(); int arrayOffset(); int readerIndex(); boolean isReadable(); ByteBuf nettyByteBuf(); void addBuffer(ByteBuf buffer); ByteBuf readRetainedSlice(int length); ByteBuf retainedSlice(int length); void skipBytes(int length); DynamicCompositeByteBuf readBytes(byte[] dst); DynamicCompositeByteBuf readBytes(byte[] dst, int dstIndex, int length); byte readByte(); short readUnsignedByte(); short readShort(); short readShortLE(); int readUnsignedShort(); int readUnsignedShortLE(); int readInt(); int readIntLE(); long readLong(); long readLongLE(); char readChar(); float readFloat(); float readFloatLE(); double readDouble(); double readDoubleLE(); ByteOrder order(); void release(); @Override String toString();  }