Java FloatBuffer Clone clone(FloatBuffer src)

Here you can find the source of clone(FloatBuffer src)

Description

clone

License

Open Source License

Declaration

static public FloatBuffer clone(FloatBuffer src) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.nio.*;

public class Main {
    static public FloatBuffer clone(FloatBuffer src) {
        src.rewind();//  w ww.  j ava  2 s .c  o m
        FloatBuffer copy = createFloatBuffer(src.limit());
        copy.put(src);
        return copy;
    }

    static public FloatBuffer createFloatBuffer(int limit) {
        FloatBuffer buf = ByteBuffer.allocateDirect(4 * limit).order(ByteOrder.nativeOrder()).asFloatBuffer();
        buf.clear();
        return buf;
    }
}

Related

  1. clone(FloatBuffer original)