copyOf

fun ByteBuffer.copyOf(): ByteBuffer
fun ShortBuffer.copyOf(): ShortBuffer
fun IntBuffer.copyOf(): IntBuffer
fun LongBuffer.copyOf(): LongBuffer
fun FloatBuffer.copyOf(): FloatBuffer
fun DoubleBuffer.copyOf(): DoubleBuffer
fun CharBuffer.copyOf(): CharBuffer

Returns new array which is a copy of the original array.

Samples

kool.buffers.Arrays.CopyOfOperations.copyOf
fun ByteBuffer.copyOf(newSize: Int): ByteBuffer
fun ShortBuffer.copyOf(newSize: Int): ShortBuffer
fun IntBuffer.copyOf(newSize: Int): IntBuffer
fun LongBuffer.copyOf(newSize: Int): LongBuffer
fun FloatBuffer.copyOf(newSize: Int): FloatBuffer
fun DoubleBuffer.copyOf(newSize: Int): DoubleBuffer
fun CharBuffer.copyOf(newSize: Int): CharBuffer

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

  • If newSize is less than the size of the original array, the copy array is truncated to the newSize.

  • If newSize is greater than the size of the original array, the extra elements in the copy array are filled with zero values.

Samples

kool.buffers.Arrays.CopyOfOperations.resizedPrimitiveCopyOf