@Override public void write(int b) { getChronicleUnsafe().putByte(position, (byte) b); incrementPositionAddr(1); }
@Override public void writeByte(long offset, int b) { offsetChecks(offset, 1L); getChronicleUnsafe().putByte(start + offset, (byte) b); }
@Override public void write(int b) { getChronicleUnsafe().putByte(position, (byte) b); incrementPositionAddr(1); }
@Override public void writeByte(long offset, int b) { offsetChecks(offset, 1L); getChronicleUnsafe().putByte(start + offset, (byte) b); }
private Bytes zeroOutDirty(long start, long end) { if (start < 0 || end > limit()) throw new IllegalArgumentException("start: " + start + ", end: " + end); if (start >= end) return this; // get unaligned leading bytes ChronicleUnsafe unsafe = getChronicleUnsafe(); while (start < end && (start & 7) != 0) { byte b = unsafe.getByte(this.start + start); if (b != 0) unsafe.putByte(this.start + start, (byte) 0); start++; } // check 64-bit aligned access while (start < end - 7) { long l = unsafe.getLong(this.start + start); if (l != 0) unsafe.putLong(this.start + start, 0L); start += 8; } // check unaligned tail while (start < end) { byte b = unsafe.getByte(this.start + start); if (b != 0) unsafe.putByte(this.start + start, (byte) 0); start++; } return this; }
private Bytes zeroOutDirty(long start, long end) { if (start < 0 || end > limit()) throw new IllegalArgumentException("start: " + start + ", end: " + end); if (start >= end) return this; // get unaligned leading bytes ChronicleUnsafe unsafe = getChronicleUnsafe(); while (start < end && (start & 7) != 0) { byte b = unsafe.getByte(this.start + start); if (b != 0) unsafe.putByte(this.start + start, (byte) 0); start++; } // check 64-bit aligned access while (start < end - 7) { long l = unsafe.getLong(this.start + start); if (l != 0) unsafe.putLong(this.start + start, 0L); start += 8; } // check unaligned tail while (start < end) { byte b = unsafe.getByte(this.start + start); if (b != 0) unsafe.putByte(this.start + start, (byte) 0); start++; } return this; }
@Override public void readObject(Object object, int start, int end) { int len = end - start; if (position + len >= limit) throw new IndexOutOfBoundsException("Length out of bounds len: " + len); ChronicleUnsafe unsafe = getChronicleUnsafe(); for (; len >= 8; len -= 8) { unsafe.putLong(object, (long) start, unsafe.getLong(position)); incrementPositionAddr(8L); start += 8; } for (; len > 0; len--) { unsafe.putByte(object, (long) start, unsafe.getByte(position)); incrementPositionAddr(1L); start++; } }
@Override public void readObject(Object object, int start, int end) { int len = end - start; if (position + len >= limit) throw new IndexOutOfBoundsException("Length out of bounds len: " + len); ChronicleUnsafe unsafe = getChronicleUnsafe(); for (; len >= 8; len -= 8) { unsafe.putLong(object, (long) start, unsafe.getLong(position)); incrementPositionAddr(8L); start += 8; } for (; len > 0; len--) { unsafe.putByte(object, (long) start, unsafe.getByte(position)); incrementPositionAddr(1L); start++; } }
@Override public void writeObject(Object object, int start, int end) { int len = end - start; ChronicleUnsafe unsafe = getChronicleUnsafe(); for (; len >= 8; len -= 8) { positionChecks(position + 8L); unsafe.putLong(position, unsafe.getLong(object, (long) start)); position += 8; start += 8; } for (; len > 0; len--) { positionChecks(position + 1L); unsafe.putByte(position, unsafe.getByte(object, (long) start)); position++; start++; } }
@Override public void writeObject(Object object, int start, int end) { int len = end - start; ChronicleUnsafe unsafe = getChronicleUnsafe(); for (; len >= 8; len -= 8) { positionChecks(position + 8L); unsafe.putLong(position, unsafe.getLong(object, (long) start)); position += 8; start += 8; } for (; len > 0; len--) { positionChecks(position + 1L); unsafe.putByte(position, unsafe.getByte(object, (long) start)); position++; start++; } }