Java Utililty Methods ByteBuffer Flip

List of utility methods to do ByteBuffer Flip

Description

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

Method

voidflip(ByteBuffer b)
flip
b.limit(b.position());
b.reset(); 
voidflip(ByteBuffer buffer)
Flip the byte buffer
buffer.flip();
voidflip(ByteBuffer bytes, int width, int height)
flip
byte[] line = new byte[width];
byte[] line2 = new byte[width];
for (int i = 0; i < height / 2; i++) {
    bytes.position(i * width);
    bytes.get(line);
    bytes.position((height - i - 1) * width);
    bytes.get(line2);
    bytes.position(i * width);
...
voidflip(ByteBuffer bytes, int width, int height)
flip
byte[] line = new byte[width];
byte[] line2 = new byte[width];
for (int i = 0; i < height / 2; i++) {
    bytes.position(i * width);
    bytes.get(line);
    bytes.position((height - i - 1) * width);
    bytes.get(line2);
    bytes.position(i * width);
...
voidflip(ByteBuffer[] buffers)
flip
if (buffers == null) {
    return;
for (ByteBuffer buffer : buffers) {
    if (buffer != null) {
        buffer.flip();
voidflip(ByteBuffer[] bufs)
flip
for (int i = 0; i < bufs.length; i++) {
    bufs[i].flip();
intflipPutFlip(ByteBuffer from, ByteBuffer to)
Put data from one buffer into another, avoiding over/under flows
return append(to, from);
intflipToFill(ByteBuffer buffer)
Flip the buffer to fill mode.
int position = buffer.position();
int limit = buffer.limit();
if (position == limit) {
    buffer.position(0);
    buffer.limit(buffer.capacity());
    return 0;
int capacity = buffer.capacity();
...
voidflipToFlush(ByteBuffer buffer, int position)
Flip the buffer to Flush mode.
buffer.limit(buffer.position());
buffer.position(position);
booleanreadAndFlip(ReadableByteChannel channel, ByteBuffer buffer, int bytes)
read And Flip
buffer.clear();
buffer.limit(bytes);
while (buffer.hasRemaining()) {
    int read = channel.read(buffer);
    if (read == -1) {
        return false;
buffer.flip();
return true;