tuweni / org.apache.tuweni.bytes / Bytes / copyTo

copyTo

open fun copyTo(destination: MutableBytes!): Unit (source)

Copy the bytes of this value to the provided mutable one, which must have the same size.

Parameters

destination - MutableBytes!: The mutable value to which to copy the bytes to, which must have the same size as this value. If you want to copy value where size differs, you should use #slice and/or MutableBytes#mutableSlice and apply the copy to the result.

Exceptions

IllegalArgumentException - if this.size() != destination.size().

open fun copyTo(destination: MutableBytes!, destinationOffset: Int): Unit (source)

Copy the bytes of this value to the provided mutable one from a particular offset.

This is a (potentially slightly more efficient) shortcut for copyTo(destination.mutableSlice(destinationOffset, this.size())).

Parameters

destination - MutableBytes!: The mutable value to which to copy the bytes to, which must have enough bytes from destinationOffset for the copied value.

destinationOffset - Int: The offset in destination at which the copy starts.

Exceptions

IllegalArgumentException - if the destination doesn't have enough room, that is if this.size() > (destination.size() - destinationOffset).