Android DoubleBuffer to ByteBuffer Convert copyDoubleBufferAsByteBuffer( DoubleBuffer paramDoubleBuffer)

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

Description

copy Double Buffer As Byte Buffer

Declaration

public static ByteBuffer copyDoubleBufferAsByteBuffer(
            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 ByteBuffer copyDoubleBufferAsByteBuffer(
            DoubleBuffer paramDoubleBuffer) {
        ByteBuffer localByteBuffer = newByteBuffer(paramDoubleBuffer
                .remaining() * 8);//from ww w  .j  av  a2s .  c  o m
        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;
    }
}