Java FloatBuffer Copy copy(final FloatBuffer source, final int fromPos, final FloatBuffer destination, final int toPos, final int length)

Here you can find the source of copy(final FloatBuffer source, final int fromPos, final FloatBuffer destination, final int toPos, final int length)

Description

Copies floats from one buffer to another.

License

Open Source License

Parameter

Parameter Description
source the buffer to copy from
fromPos the starting point to copy from
destination the buffer to copy to
toPos the starting point to copy to
length the number of floats to copy

Declaration

public static void copy(final FloatBuffer source, final int fromPos, final FloatBuffer destination,
        final int toPos, final int length) 

Method Source Code

//package com.java2s;
/**//from w w w.  ja  va  2  s.  c  o m
 * Copyright (c) 2008-2012 Ardor Labs, Inc.
 *
 * This file is part of Ardor3D.
 *
 * Ardor3D is free software: you can redistribute it and/or modify it 
 * under the terms of its license which may be found in the accompanying
 * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
 */

import java.nio.FloatBuffer;

public class Main {
    /**
     * Copies floats from one buffer to another.
     * 
     * @param source
     *            the buffer to copy from
     * @param fromPos
     *            the starting point to copy from
     * @param destination
     *            the buffer to copy to
     * @param toPos
     *            the starting point to copy to
     * @param length
     *            the number of floats to copy
     */
    public static void copy(final FloatBuffer source, final int fromPos, final FloatBuffer destination,
            final int toPos, final int length) {
        final int oldLimit = source.limit();
        source.position(fromPos);
        source.limit(fromPos + length);
        destination.position(toPos);
        destination.put(source);
        source.limit(oldLimit);
    }
}

Related

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