@Override public void write(long offset, byte[] bytes, int off, int len) { if (offset < 0 || off + len > bytes.length || offset + len > capacity()) throw new IllegalArgumentException(); getChronicleUnsafe().copyMemory(bytes, BYTES_OFFSET + off, null, start + offset, len); }
@Override public void write(long offset, byte[] bytes, int off, int len) { if (offset < 0 || off + len > bytes.length || offset + len > capacity()) throw new IllegalArgumentException(); getChronicleUnsafe().copyMemory(bytes, BYTES_OFFSET + off, null, start + offset, len); }
@Override public void write(long offset, @NotNull byte[] bytes) { if (offset < 0 || offset + bytes.length > capacity()) throw new IllegalArgumentException(); getChronicleUnsafe().copyMemory(bytes, BYTES_OFFSET, null, start + offset, bytes.length); addPosition(bytes.length); }
@Override public void write(long offset, @NotNull byte[] bytes) { if (offset < 0 || offset + bytes.length > capacity()) throw new IllegalArgumentException(); getChronicleUnsafe().copyMemory(bytes, BYTES_OFFSET, null, start + offset, bytes.length); addPosition(bytes.length); }
@Override public Bytes zeroOut() { clear(); getChronicleUnsafe().setMemory(start, capacity(), (byte) 0); return this; }
@Override public Bytes zeroOut() { clear(); getChronicleUnsafe().setMemory(start, capacity(), (byte) 0); return this; }
@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; }