Java ByteBuffer to Byte Array toBytes(ByteBuffer buff)

Here you can find the source of toBytes(ByteBuffer buff)

Description

to Bytes

License

Apache License

Declaration

public static byte[] toBytes(ByteBuffer buff) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.nio.ByteBuffer;

public class Main {
    public static byte[] toBytes(ByteBuffer buff) {
        int limit = buff.limit();
        byte[] arr = new byte[limit];
        System.arraycopy(buff.array(), buff.arrayOffset() + buff.position(), arr, 0, limit);
        return arr;
    }//from  w  ww  .j ava 2 s  . c  om
}

Related

  1. toByteArray(ByteBuffer buffer)
  2. toByteArray(ByteBuffer buffer, int length)
  3. toByteArray(ByteBuffer buffer, int length)
  4. toByteArray(ByteBuffer bytes)
  5. toByteArrayByByteBuffer(int value)
  6. toBytes(ByteBuffer buffer)
  7. toBytes(ByteBuffer buffer)
  8. toBytes(ByteBuffer buffer, int offset, int length)
  9. toBytes(ByteBuffer buffer, int startPosition)