public final class BufferUtils extends Object
IntBuffer
and
ByteBuffer
.Modifier and Type | Method and Description |
---|---|
static ByteBuffer |
allocateByteBuffer(int bytes)
Allocates a new direct
ByteBuffer with the specified size and
returns it. |
static IntBuffer |
allocateIntBuffer()
Allocates a new
IntBuffer with space for exactly one integer
value. |
static LongBuffer |
allocateLongBuffer()
Allocates a new
LongBuffer with space for exactly one long value. |
static ByteBuffer |
slice(ByteBuffer buffer,
int offset,
int length)
Slices a part of the specified
ByteBuffer into a new byte buffer
and returns it. |
public static ByteBuffer allocateByteBuffer(int bytes)
ByteBuffer
with the specified size and
returns it.bytes
- The size of the new byte buffer.public static IntBuffer allocateIntBuffer()
IntBuffer
with space for exactly one integer
value.public static LongBuffer allocateLongBuffer()
LongBuffer
with space for exactly one long value.public static ByteBuffer slice(ByteBuffer buffer, int offset, int length)
ByteBuffer
into a new byte buffer
and returns it.buffer
- The byte buffer to slice data from.offset
- The offset of the part to slice.length
- The length of the part to slice.Copyright © 2011–2018 usb4java Team. All rights reserved.