Java FloatBuffer Copy copyInternal(FloatBuffer buf, int fromPos, int toPos, int length)

Here you can find the source of copyInternal(FloatBuffer buf, int fromPos, int toPos, int length)

Description

Copies floats from one position in the buffer to another.

License

Open Source License

Parameter

Parameter Description
buf the buffer to copy from/to
fromPos the starting point to copy from
toPos the starting point to copy to
length the number of floats to copy

Declaration

public static void copyInternal(FloatBuffer buf, int fromPos, int toPos, int length) 

Method Source Code

//package com.java2s;

import java.nio.FloatBuffer;

public class Main {
    /**/*from  w w  w  .ja  va2 s .c om*/
     * Copies floats from one position in the buffer to another.
     *
     * @param buf     the buffer to copy from/to
     * @param fromPos the starting point to copy from
     * @param toPos   the starting point to copy to
     * @param length  the number of floats to copy
     */
    public static void copyInternal(FloatBuffer buf, int fromPos, int toPos, int length) {
        float[] data = new float[length];
        buf.position(fromPos);
        buf.get(data);
        buf.position(toPos);
        buf.put(data);
    }
}

Related

  1. copy(final FloatBuffer source, final int fromPos, final FloatBuffer destination, final int toPos, final int length)
  2. copy(float[] vertices, FloatBuffer floatBuffer, int numFloats, int offset)
  3. copyFloatBuffer(FloatBuffer buf)
  4. copyInternalVector2(final FloatBuffer buf, final int fromPos, final int toPos)
  5. copyInternalVector3(FloatBuffer buf, int fromPos, int toPos)