Java Utililty Methods ByteBuffer Allocate

List of utility methods to do ByteBuffer Allocate

  1. HOME
  2. Java
  3. B
  4. ByteBuffer Allocate

Description

The list of methods to do ByteBuffer Allocate are organized into topic(s).

Method

ByteBuffer allocate(int capacity)
allocate
ByteBuffer bb = ByteBuffer.allocate(capacity);
bb.order(BYTE_ORDER);
return bb;
ByteBuffer allocate(int capacity, boolean direct)
Allocate ByteBuffer.
if (capacity < 0)
 throw new IllegalArgumentException("capacity can't be negative");
return direct ? ByteBuffer.allocateDirect(capacity) : ByteBuffer.allocate(capacity);
ByteBuffer allocate(int length)
allocate
return ByteBuffer.allocate(length);
ByteBuffer allocate(int length, byte fillwith)
allocate
byte[] bytes = new byte[length];
for (int i = 0; i < length; i++)
 bytes[i] = fillwith;
return ByteBuffer.wrap(bytes);
ByteBuffer allocate(int size)
allocate
return ByteBuffer.allocate(size).order(STORED_BYTE_ORDER);
ByteBuffer allocate(int size)
allocate
if (size > DIRECT_THRESHOLD) {
 return ByteBuffer.allocateDirect(size);
} else {
 try {
 return ByteBuffer.allocate(size);
 } catch (OutOfMemoryError ex) {
 return ByteBuffer.allocateDirect(size);
ByteBuffer allocateBuffer(int size, boolean isDirect)
allocate Buffer
final ByteBuffer buffer;
if (isDirect) {
 buffer = ByteBuffer.allocateDirect(size);
} else {
 buffer = ByteBuffer.allocate(size);
return buffer;
ByteBuffer allocateDirect(int capacity)
Allocate ByteBuffer in flush mode.
ByteBuffer buf = ByteBuffer.allocateDirect(capacity);
buf.limit(0);
return buf;
ByteBuffer allocateDirectBuffer(int size)
allocate Direct Buffer
if (size > directBufferSize) {
 directBufferSize = size;
 directBuffer = ByteBuffer.allocateDirect(directBufferSize).order(ByteOrder.nativeOrder());
directBuffer.clear();
directBuffer.limit(size);
return directBuffer;
IntBuffer allocateDirectInt(int size)
allocate Direct Int
ByteBuffer bb = ByteBuffer.allocateDirect(size * 4);
bb.order(ByteOrder.nativeOrder());
return bb.asIntBuffer();


AltStyle によって変換されたページ (->オリジナル) /