IoBuffer { public IoBuffer flip() { limit = position; position = getPointerByPosition(0); return this; } private  IoBuffer(); static IoBuffer allocate(int capacity); static IoBuffer allocateDirect(int capacity); static IoBuffer newInstance(); static IoBuffer wrap(byte[]... arrays); static IoBuffer wrap(byte[] array, int offset, int length); static IoBuffer wrap(ByteBuffer... buffers); IoBuffer add(ByteBuffer... buffers); byte[] array(); int arrayOffset(); InputStream asInputStream(); IoBuffer asReadOnlyBuffer(); int capacity(); IoBuffer clear(); IoBuffer compact(); IoBuffer duplicate(); @Override boolean equals(Object ob); IoBuffer extend(int size); IoBuffer flip(); byte get(); IoBuffer get(byte[] dst); IoBuffer get(byte[] dst, int offset, int length); byte get(int index); char getChar(); char getChar(int index); double getDouble(); double getDouble(int index); float getFloat(); float getFloat(int index); int getInt(); int getInt(int index); long getLong(); long getLong(int index); short getShort(); long getShort(int index); @Override int hashCode(); boolean hasRemaining(); boolean isDirect(); boolean isReadOnly(); int limit(); void limit(int newLimit); void mark(); ByteOrder order(); IoBuffer order(ByteOrder bo); int position(); void position(int newPosition); IoBuffer put(byte b); IoBuffer put(byte[] src); IoBuffer put(ByteBuffer src); IoBuffer put(IoBuffer src); IoBuffer put(byte[] src, int offset, int length); IoBuffer put(int index, byte value); IoBuffer putChar(char value); IoBuffer putChar(int index, char value); IoBuffer putDouble(double value); IoBuffer putDouble(int index, double value); IoBuffer putFloat(float value); IoBuffer putFloat(int index, float value); IoBuffer putInt(int value); IoBuffer putInt(int index, int value); IoBuffer putLong(int index, long value); IoBuffer putLong(long value); IoBuffer putShort(int index, short value); IoBuffer putShort(short value); int remaining(); IoBuffer reset(); IoBuffer rewind(); IoBuffer slice(); @Override String toString();  }
@Test public void testFlip() { ByteBuffer bb1 = ByteBuffer.allocate(4); bb1.put("0123".getBytes()); bb1.flip(); ByteBuffer bb2 = ByteBuffer.allocate(4); bb2.put("4567".getBytes()); bb2.flip(); IoBuffer ioBuffer = IoBuffer.wrap(bb1, bb2); ioBuffer.get(); ioBuffer.get(); ioBuffer.clear(); assertEquals(0, ioBuffer.position()); assertEquals(8, ioBuffer.limit()); }