@Override public boolean compare(long offset, RandomDataInput input, long inputOffset, long len) { if (offset < 0 || inputOffset < 0 || len < 0) throw new IndexOutOfBoundsException(); if (offset + len < 0 || offset + len > capacity() || inputOffset + len < 0 || inputOffset + len > input.capacity()) { return false; } long i = 0L; for (; i < len - 7L; i += 8L) { if (UNSAFE.getLong(startAddr + offset + i) != input.readLong(inputOffset + i)) return false; } if (i < len - 3L) { if (UNSAFE.getInt(startAddr + offset + i) != input.readInt(inputOffset + i)) return false; i += 4L; } if (i < len - 1L) { if (UNSAFE.getChar(startAddr + offset + i) != input.readChar(inputOffset + i)) return false; i += 2L; } if (i < len) { if (UNSAFE.getByte(startAddr + offset + i) != input.readByte(inputOffset + i)) return false; } return true; }
@Override public void write(RandomDataInput bytes, long position, long length) { if (length > remaining()) throw new IllegalArgumentException("Attempt to write " + length + " bytes with " + remaining() + " remaining"); if (bytes.byteOrder() == byteOrder()) { while (length >= 8) { writeLong(bytes.readLong(position)); position += 8; length -= 8; } } while (length >= 1) { writeByte(bytes.readByte(position)); position++; length--; } }
@Override public boolean compare(long offset, RandomDataInput input, long inputOffset, long len) { if (offset < 0 || inputOffset < 0 || len < 0) throw new IndexOutOfBoundsException(); if (offset + len < 0 || offset + len > capacity() || inputOffset + len < 0 || inputOffset + len > input.capacity()) { return false; } long i = 0L; for (; i < len - 7L; i += 8L) { if (UNSAFE.getLong(startAddr + offset + i) != input.readLong(inputOffset + i)) return false; } if (i < len - 3L) { if (UNSAFE.getInt(startAddr + offset + i) != input.readInt(inputOffset + i)) return false; i += 4L; } if (i < len - 1L) { if (UNSAFE.getChar(startAddr + offset + i) != input.readChar(inputOffset + i)) return false; i += 2L; } if (i < len) { if (UNSAFE.getByte(startAddr + offset + i) != input.readByte(inputOffset + i)) return false; } return true; }
@Override public void write(RandomDataInput bytes, long position, long length) { if (length > remaining()) throw new IllegalArgumentException("Attempt to write " + length + " bytes with " + remaining() + " remaining"); if (bytes.byteOrder() == byteOrder()) { while (length >= 8) { writeLong(bytes.readLong(position)); position += 8; length -= 8; } } while (length >= 1) { writeByte(bytes.readByte(position)); position++; length--; } }
@Override public boolean compare(long offset, RandomDataInput input, long inputOffset, long len) { if (offset < 0 || inputOffset < 0 || len < 0) throw new IndexOutOfBoundsException(); if (offset + len < 0 || offset + len > capacity() || inputOffset + len < 0 || inputOffset + len > input.capacity()) { return false; } long i = 0L; for (; i < len - 7L; i += 8L) { if (readLong(offset + i) != input.readLong(inputOffset + i)) return false; } if (i < len - 3L) { if (readInt(offset + i) != input.readInt(inputOffset + i)) return false; i += 4L; } if (i < len - 1L) { if (readChar(offset + i) != input.readChar(inputOffset + i)) return false; i += 2L; } if (i < len) { if (readByte(offset + i) != input.readByte(inputOffset + i)) return false; } return true; }
@Override public boolean compare(long offset, RandomDataInput input, long inputOffset, long len) { if (offset < 0 || inputOffset < 0 || len < 0) throw new IndexOutOfBoundsException(); if (offset + len < 0 || offset + len > capacity() || inputOffset + len < 0 || inputOffset + len > input.capacity()) { return false; } long i = 0L; for (; i < len - 7L; i += 8L) { if (readLong(offset + i) != input.readLong(inputOffset + i)) return false; } if (i < len - 3L) { if (readInt(offset + i) != input.readInt(inputOffset + i)) return false; i += 4L; } if (i < len - 1L) { if (readChar(offset + i) != input.readChar(inputOffset + i)) return false; i += 2L; } if (i < len) { if (readByte(offset + i) != input.readByte(inputOffset + i)) return false; } return true; }
@Override public boolean compare(long offset, RandomDataInput input, long inputOffset, long len) { if (offset < 0 || inputOffset < 0 || len < 0) throw new IndexOutOfBoundsException(); if (offset + len < 0 || offset + len > capacity() || inputOffset + len < 0 || inputOffset + len > input.capacity()) { return false; } long i = 0L; ChronicleUnsafe unsafe = getChronicleUnsafe(); for (; i < len - 7L; i += 8L) { if (unsafe.getLong(start + offset + i) != input.readLong(inputOffset + i)) return false; } if (i < len - 3L) { if (unsafe.getInt(start + offset + i) != input.readInt(inputOffset + i)) return false; i += 4L; } if (i < len - 1L) { if (unsafe.getChar(start + offset + i) != input.readChar(inputOffset + i)) return false; i += 2L; } if (i < len) { if (unsafe.getByte(start + offset + i) != input.readByte(inputOffset + i)) return false; } return true; }
@Override public boolean compare(long offset, RandomDataInput input, long inputOffset, long len) { if (offset < 0 || inputOffset < 0 || len < 0) throw new IndexOutOfBoundsException(); if (offset + len < 0 || offset + len > capacity() || inputOffset + len < 0 || inputOffset + len > input.capacity()) { return false; } long i = 0L; ChronicleUnsafe unsafe = getChronicleUnsafe(); for (; i < len - 7L; i += 8L) { if (unsafe.getLong(start + offset + i) != input.readLong(inputOffset + i)) return false; } if (i < len - 3L) { if (unsafe.getInt(start + offset + i) != input.readInt(inputOffset + i)) return false; i += 4L; } if (i < len - 1L) { if (unsafe.getChar(start + offset + i) != input.readChar(inputOffset + i)) return false; i += 2L; } if (i < len) { if (unsafe.getByte(start + offset + i) != input.readByte(inputOffset + i)) return false; } return true; }