/** * Returns {@code true} if the {@link SimpleString} encoded content into {@code bytes} is equals to {@code s}, * {@code false} otherwise. * <p> * It assumes that the {@code bytes} content is read using {@link SimpleString#readSimpleString(ByteBuf, int)} ie starting right after the * length field. */ public static boolean equals(final byte[] bytes, final ByteBuf byteBuf, final int offset, final int length) { if (bytes.length != length) return false; if (PlatformDependent.isUnaligned() && PlatformDependent.hasUnsafe()) { if ((offset + length) > byteBuf.writerIndex()) { throw new IndexOutOfBoundsException(); } if (byteBuf.hasArray()) { return equals(bytes, byteBuf.array(), byteBuf.arrayOffset() + offset, length); } else if (byteBuf.hasMemoryAddress()) { return equalsOffHeap(bytes, byteBuf.memoryAddress(), offset, length); } } return equalsOnHeap(bytes, byteBuf, offset, length); }
/** * Returns {@code true} if the {@link SimpleString} encoded content into {@code bytes} is equals to {@code s}, * {@code false} otherwise. * <p> * It assumes that the {@code bytes} content is read using {@link SimpleString#readSimpleString(ByteBuf, int)} ie starting right after the * length field. */ public static boolean equals(final byte[] bytes, final ByteBuf byteBuf, final int offset, final int length) { if (bytes.length != length) return false; if (PlatformDependent.isUnaligned() && PlatformDependent.hasUnsafe()) { if ((offset + length) > byteBuf.writerIndex()) { throw new IndexOutOfBoundsException(); } if (byteBuf.hasArray()) { return equals(bytes, byteBuf.array(), byteBuf.arrayOffset() + offset, length); } else if (byteBuf.hasMemoryAddress()) { return equalsOffHeap(bytes, byteBuf.memoryAddress(), offset, length); } } return equalsOnHeap(bytes, byteBuf, offset, length); }
/** * Returns {@code true} if the {@link SimpleString} encoded content into {@code bytes} is equals to {@code s}, * {@code false} otherwise. * <p> * It assumes that the {@code bytes} content is read using {@link SimpleString#readSimpleString(ByteBuf, int)} ie starting right after the * length field. */ public static boolean equals(final byte[] bytes, final ByteBuf byteBuf, final int offset, final int length) { if (bytes.length != length) return false; if (PlatformDependent.isUnaligned() && PlatformDependent.hasUnsafe()) { if ((offset + length) > byteBuf.writerIndex()) { throw new IndexOutOfBoundsException(); } if (byteBuf.hasArray()) { return equals(bytes, byteBuf.array(), byteBuf.arrayOffset() + offset, length); } else if (byteBuf.hasMemoryAddress()) { return equalsOffHeap(bytes, byteBuf.memoryAddress(), offset, length); } } return equalsOnHeap(bytes, byteBuf, offset, length); }
/** * Returns {@code true} if the {@link SimpleString} encoded content into {@code bytes} is equals to {@code s}, * {@code false} otherwise. * <p> * It assumes that the {@code bytes} content is read using {@link SimpleString#readSimpleString(ByteBuf, int)} ie starting right after the * length field. */ public static boolean equals(final byte[] bytes, final ByteBuf byteBuf, final int offset, final int length) { if (bytes.length != length) return false; if (PlatformDependent.isUnaligned() && PlatformDependent.hasUnsafe()) { if ((offset + length) > byteBuf.writerIndex()) { throw new IndexOutOfBoundsException(); } if (byteBuf.hasArray()) { return equals(bytes, byteBuf.array(), byteBuf.arrayOffset() + offset, length); } else if (byteBuf.hasMemoryAddress()) { return equalsOffHeap(bytes, byteBuf.memoryAddress(), offset, length); } } return equalsOnHeap(bytes, byteBuf, offset, length); }
/** * Returns {@code true} if the {@link SimpleString} encoded content into {@code bytes} is equals to {@code s}, * {@code false} otherwise. * <p> * It assumes that the {@code bytes} content is read using {@link SimpleString#readSimpleString(ByteBuf, int)} ie starting right after the * length field. */ public static boolean equals(final byte[] bytes, final ByteBuf byteBuf, final int offset, final int length) { if (bytes.length != length) return false; if (PlatformDependent.isUnaligned() && PlatformDependent.hasUnsafe()) { if ((offset + length) > byteBuf.writerIndex()) { throw new IndexOutOfBoundsException(); } if (byteBuf.hasArray()) { return equals(bytes, byteBuf.array(), byteBuf.arrayOffset() + offset, length); } else if (byteBuf.hasMemoryAddress()) { return equalsOffHeap(bytes, byteBuf.memoryAddress(), offset, length); } } return equalsOnHeap(bytes, byteBuf, offset, length); }
/** * Returns {@code true} if the {@link SimpleString} encoded content into {@code bytes} is equals to {@code s}, * {@code false} otherwise. * <p> * It assumes that the {@code bytes} content is read using {@link SimpleString#readSimpleString(ByteBuf, int)} ie starting right after the * length field. */ public static boolean equals(final byte[] bytes, final ByteBuf byteBuf, final int offset, final int length) { if (bytes.length != length) return false; if (PlatformDependent.isUnaligned() && PlatformDependent.hasUnsafe()) { if ((offset + length) > byteBuf.writerIndex()) { throw new IndexOutOfBoundsException(); } if (byteBuf.hasArray()) { return equals(bytes, byteBuf.array(), byteBuf.arrayOffset() + offset, length); } else if (byteBuf.hasMemoryAddress()) { return equalsOffHeap(bytes, byteBuf.memoryAddress(), offset, length); } } return equalsOnHeap(bytes, byteBuf, offset, length); }
/** * Returns {@code true} if the {@link SimpleString} encoded content into {@code bytes} is equals to {@code s}, * {@code false} otherwise. * <p> * It assumes that the {@code bytes} content is read using {@link SimpleString#readSimpleString(ByteBuf, int)} ie starting right after the * length field. */ public static boolean equals(final byte[] bytes, final ByteBuf byteBuf, final int offset, final int length) { if (bytes.length != length) return false; if (PlatformDependent.isUnaligned() && PlatformDependent.hasUnsafe()) { if ((offset + length) > byteBuf.writerIndex()) { throw new IndexOutOfBoundsException(); } if (byteBuf.hasArray()) { return equals(bytes, byteBuf.array(), byteBuf.arrayOffset() + offset, length); } else if (byteBuf.hasMemoryAddress()) { return equalsOffHeap(bytes, byteBuf.memoryAddress(), offset, length); } } return equalsOnHeap(bytes, byteBuf, offset, length); }