Android DoubleBuffer Copy copyDoubleBuffer( DoubleBuffer paramDoubleBuffer)

Here you can find the source of copyDoubleBuffer( DoubleBuffer paramDoubleBuffer)

Description

copy Double Buffer

Declaration

public static DoubleBuffer copyDoubleBuffer(
            DoubleBuffer paramDoubleBuffer) 

Method Source Code

//package com.java2s;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.DoubleBuffer;

public class Main {
    public static DoubleBuffer copyDoubleBuffer(
            DoubleBuffer paramDoubleBuffer) {
        return copyDoubleBufferAsByteBuffer(paramDoubleBuffer)
                .asDoubleBuffer();// w  w w  .j  av  a 2  s  .c  o m
    }

    public static ByteBuffer copyDoubleBufferAsByteBuffer(
            DoubleBuffer paramDoubleBuffer) {
        ByteBuffer localByteBuffer = newByteBuffer(paramDoubleBuffer
                .remaining() * 8);
        paramDoubleBuffer.mark();
        localByteBuffer.asDoubleBuffer().put(paramDoubleBuffer);
        paramDoubleBuffer.reset();
        localByteBuffer.rewind();
        return localByteBuffer;
    }

    public static ByteBuffer newByteBuffer(int paramInt) {
        ByteBuffer localByteBuffer = ByteBuffer.allocateDirect(paramInt);
        localByteBuffer.order(ByteOrder.nativeOrder());
        return localByteBuffer;
    }
}