Android LongBuffer to ByteBuffer Convert copyLongBufferAsByteBuffer( LongBuffer paramLongBuffer)

Here you can find the source of copyLongBufferAsByteBuffer( LongBuffer paramLongBuffer)

Description

copy Long Buffer As Byte Buffer

Declaration

public static ByteBuffer copyLongBufferAsByteBuffer(
            LongBuffer paramLongBuffer) 

Method Source Code

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

import java.nio.LongBuffer;

public class Main {
    public static ByteBuffer copyLongBufferAsByteBuffer(
            LongBuffer paramLongBuffer) {
        ByteBuffer localByteBuffer = newByteBuffer(paramLongBuffer
                .remaining() * 8);/*from   w  ww  . java  2s.  co m*/
        paramLongBuffer.mark();
        localByteBuffer.asLongBuffer().put(paramLongBuffer);
        paramLongBuffer.reset();
        localByteBuffer.rewind();
        return localByteBuffer;
    }

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