public long remaining() { return wrapped.remaining(); }
public long remaining() { return wrapped.remaining(); }
private void checkAvailable(int n) throws IOException { if (n > bytes.remaining()) throw new IOException("Not enough available space for writing " + n + " bytes"); }
private void checkAvailable(int n) throws IOException { if (n > bytes.remaining()) throw new IOException("Not enough available space for writing " + n + " bytes"); }
public long remaining() { this.checkNotClosed(); return this.bytes.remaining(); }
public long remaining() { this.checkNotClosed(); return this.bytes.remaining(); }
protected boolean hasRoomForExcerpt(ByteBuffer buffer, Bytes tailer) { return hasRoomFor(buffer, tailer.remaining() + ChronicleTcp.HEADER_SIZE); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
boolean nextEntry(@NotNull final EntryCallback callback) { return instance.nextEntry((key, value, timestamp, identifier, isDeleted, bootStrapTimeStamp) -> { final KvBytes threadLocal = kvBytesThreadLocal.get(); @NotNull VanillaReplicatedEntry entry = new VanillaReplicatedEntry( toKey(key, threadLocal.key(key.remaining())), toValue(value, threadLocal.value(value.remaining())), timestamp, identifier, isDeleted, bootStrapTimeStamp, remoteIdentifier); return callback.onEntry(entry); }); }
@Override public void readMarshallable(@NotNull Bytes in) throws IllegalStateException { long len = Math.min(remaining(), in.remaining()); long inPosition = in.position(); write(in, inPosition, len); in.position(inPosition + len); }
@Override public void readMarshallable(@NotNull Bytes in) throws IllegalStateException { long len = Math.min(remaining(), in.remaining()); long inPosition = in.position(); write(in, inPosition, len); in.position(inPosition + len); }
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); } }
while (position < length) { while (position < length && db.remaining() >= 3) db.writeStopBit(s.charAt(position++)); dbb.position(0);
while (db.remaining() > 0) chars[pos++] = (char) db.readStopBit();
while (db.remaining() > 0) chars[pos++] = (char) db.readStopBit();
@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()); }