public byte readByte() { return wrapped.readByte(); }
public byte readByte(long offset) { return wrapped.readByte(offset); }
public byte readByte(long offset) { return wrapped.readByte(offset); }
public byte readByte() { return wrapped.readByte(); }
public byte readByte(long offset) { this.checkNotClosed(); return this.bytes.readByte(offset); }
public T read(Bytes bytes, T tObject) { long i = metadata.start; long end = metadata.start + metadata.length; while (i < end - 7) { UNSAFE.putLong(tObject, i, bytes.readLong()); i += 8; } while (i < end) { UNSAFE.putByte(tObject, i, bytes.readByte()); ++i; } return tObject; }
public byte readByte() { this.checkNotClosed(); return this.bytes.readByte(); }
public byte readByte(long offset) { this.checkNotClosed(); return this.bytes.readByte(offset); }
public byte readByte() { this.checkNotClosed(); return this.bytes.readByte(); }
/** * display the buffer as a string * * @param buffer the buffer you wish to toString() * @return hex representation of the buffer, from example [0D ,OA, FF] */ public static String toString(@NotNull final Bytes buffer) { final Bytes slice = buffer.slice(); final StringBuilder builder = new StringBuilder(""); while (slice.remaining() > 0) { final byte b = slice.readByte(); builder.append((char) b); } return builder.toString(); }
/** * display the buffer as a string * * @param buffer the buffer you wish to toString() * @return hex representation of the buffer, from example [0D ,OA, FF] */ public static String toString(@NotNull final Bytes buffer) { final Bytes slice = buffer.slice(); final StringBuilder builder = new StringBuilder(""); while (slice.remaining() > 0) { final byte b = slice.readByte(); builder.append((char) b); } return builder.toString(); }
/** * display the hex data of {@link Bytes} from the position() to the limit() * * @param buffer the buffer you wish to toString() * @return hex representation of the buffer, from example [0D ,OA, FF] */ public static String toHex(@NotNull final Bytes buffer) { if (buffer.remaining() == 0) return ""; final Bytes slice = buffer.slice(); final StringBuilder builder = new StringBuilder("["); while (slice.remaining() > 0) { final byte b = slice.readByte(); builder.append(((char) b) + "(" + String.format("%02X ", b).trim() + ")"); builder.append(","); } // remove the last comma builder.deleteCharAt(builder.length() - 1); builder.append("]"); return builder.toString(); }
private long hash0(Bytes bytes, long offset, long limit) { long h = 0; long i = offset; for (; i < limit - 7; i += 8) h = LONG_LEVEL_PRIME_MULTIPLE * h + bytes.readLong(i); for (; i < limit - 1; i += 2) h = SHORT_LEVEL_PRIME_MULTIPLE * h + bytes.readShort(i); if (i < limit) h = BYTE_LEVEL_PRIME_MULTIPLE * h + bytes.readByte(i); return h; } }
/** * display the hex data of {@link Bytes} from the position() to the limit() * * @param buffer the buffer you wish to toString() * @return hex representation of the buffer, from example [0D ,OA, FF] */ public static String toHex(@NotNull final Bytes buffer) { if (buffer.remaining() == 0) return ""; final Bytes slice = buffer.slice(); final StringBuilder builder = new StringBuilder("["); while (slice.remaining() > 0) { final byte b = slice.readByte(); builder.append(((char) b) + "(" + String.format("%02X ", b).trim() + ")"); builder.append(","); } // remove the last comma builder.deleteCharAt(builder.length() - 1); builder.append("]"); return builder.toString(); }
private long hash0(Bytes bytes, long offset, long limit) { long h = 0; long i = offset; for (; i < limit - 7; i += 8) h = LONG_LEVEL_PRIME_MULTIPLE * h + bytes.readLong(i); for (; i < limit - 1; i += 2) h = SHORT_LEVEL_PRIME_MULTIPLE * h + bytes.readShort(i); if (i < limit) h = BYTE_LEVEL_PRIME_MULTIPLE * h + bytes.readByte(i); return h; } }
private void check(@NotNull net.openhft.lang.io.Bytes b) { if (b.position() != 0) throw new AssertionError(); if (b.remaining() != b.limit()) throw new AssertionError(); for (long i = 0; i < 16 && i < b.limit(); i++) { int ch = b.readByte(i); if (ch < ' ') throw new AssertionError("Char " + ch); } if (b.limit() > 32) for (long i = b.limit() - 16; i < b.limit(); i++) { int ch = b.readByte(i); if (ch < ' ') throw new AssertionError("Char " + ch); } }
@Override public void write(long offset, Bytes bytes) { long length = bytes.remaining(); checkWrite(length); long i; for (i = 0; i < length - 7; i += 8) writeLong(offset + i, bytes.readLong()); for (; i < length; i++) writeByte(offset + i, bytes.readByte()); }
@Override public void write(long offset, Bytes bytes) { long length = bytes.remaining(); checkWrite(length); long i; for (i = 0; i < length - 7; i += 8) writeLong(offset + i, bytes.readLong()); for (; i < length; i++) writeByte(offset + i, bytes.readByte()); }