List of utility methods to do ByteBuffer Flip
void | flip(ByteBuffer b) flip b.limit(b.position()); b.reset(); |
void | flip(ByteBuffer buffer) Flip the byte buffer buffer.flip(); |
void | flip(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); ... |
void | flip(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); ... |
void | flip(ByteBuffer[] buffers) flip if (buffers == null) { return; for (ByteBuffer buffer : buffers) { if (buffer != null) { buffer.flip(); |
void | flip(ByteBuffer[] bufs) flip for (int i = 0; i < bufs.length; i++) { bufs[i].flip(); |
int | flipPutFlip(ByteBuffer from, ByteBuffer to) Put data from one buffer into another, avoiding over/under flows return append(to, from);
|
int | flipToFill(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(); ... |
void | flipToFlush(ByteBuffer buffer, int position) Flip the buffer to Flush mode. buffer.limit(buffer.position()); buffer.position(position); |
boolean | readAndFlip(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; |