tuweni / org.apache.tuweni.bytes / Bytes / wrapBuffer

wrapBuffer

open static fun wrapBuffer(buffer: Buffer!): Bytes! (source)

Wrap a full Vert.x Buffer as a Bytes value.

Note that any change to the content of the buffer may be reflected in the returned value.

Parameters

buffer - Buffer!: The buffer to wrap.

Return
Bytes!: A Bytes value.

open static fun wrapBuffer(buffer: Buffer!, offset: Int, size: Int): Bytes! (source)

Wrap a slice of a Vert.x Buffer as a Bytes value.

Note that any change to the content of the buffer may be reflected in the returned value.

Parameters

buffer - Buffer!: The buffer to wrap.

offset - Int: The offset in buffer from which to expose the bytes in the returned value. That is, wrapBuffer(buffer, i, 1).get(0) == buffer.getByte(i).

size - Int: The size of the returned value.

Exceptions

IndexOutOfBoundsException - if offset < 0 || (buffer.length() > 0 && offset >= buffer.length()).

IllegalArgumentException - if length < 0 || offset + length > buffer.length().

Return
Bytes!: A Bytes value.