public Bytes slice() { return wrapped.slice(); }
public Bytes slice() { return wrapped.slice(); }
public Bytes slice(long offset, long length) { return wrapped.slice(offset, length); }
public Bytes slice(long offset, long length) { return wrapped.slice(offset, length); }
public Bytes slice() { this.checkNotClosed(); return this.bytes.slice(); }
public Bytes slice(long offset, long length) { this.checkNotClosed(); return this.bytes.slice(offset, length); }
public Bytes slice() { this.checkNotClosed(); return this.bytes.slice(); }
public Bytes slice(long offset, long length) { this.checkNotClosed(); return this.bytes.slice(offset, length); }
/** * 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(); }
/** * 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(); }