Java ByteBuffer Get get(ByteBuffer source)

Here you can find the source of get(ByteBuffer source)

Description

get

License

Open Source License

Declaration

public static byte[] get(ByteBuffer source) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.nio.ByteBuffer;

public class Main {
    public static byte[] get(ByteBuffer source) {
        if (source.hasArray()) {
            return source.array();
        } else {// w  ww . ja  va2 s.c  o m
            source.rewind();
            System.out.println(source.limit());
            byte[] array = new byte[source.limit()];
            for (int i = 0; i < array.length; i++) {
                array[i] = source.get();
                System.out.println(array[i]);
            }
            return array;
        }
    }
}

Related

  1. calculateNewLength(ByteBuffer source, ByteBuffer target)
  2. get(ByteBuffer buffer)
  3. get3ByteInt(ByteBuffer buffer)
  4. getActiveArray(ByteBuffer buffer)
  5. getAddress(ByteBuffer buf)
  6. getAddress(ByteBuffer buffer)