Java ByteBuffer to Byte Array toByteArray(ByteBuffer buf)

Here you can find the source of toByteArray(ByteBuffer buf)

Description

to Byte Array

License

Apache License

Declaration

static byte[] toByteArray(ByteBuffer buf) 

Method Source Code


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

import java.nio.ByteBuffer;

public class Main {
    static byte[] toByteArray(ByteBuffer buf) {
        buf.rewind();/*w  ww  .  ja v a 2s.c o m*/
        byte[] bytes = new byte[buf.limit()];
        buf.get(bytes);
        return bytes;
    }
}

Related

  1. toArray(ByteBuffer buffer)
  2. toArray(ByteBuffer bytebuffer)
  3. toArray(final ByteBuffer b)
  4. toArray(final ByteBuffer buffer)
  5. toByteArray(ByteBuffer bb)
  6. toByteArray(ByteBuffer buffer)
  7. toByteArray(ByteBuffer buffer)
  8. toByteArray(ByteBuffer buffer)
  9. toByteArray(ByteBuffer buffer)