@Test public void testPut() { ByteBuffer bb1 = ByteBuffer.allocate(5); bb1.put("012".getBytes()); bb1.flip(); ByteBuffer bb2 = ByteBuffer.allocate(5); bb2.put("345".getBytes()); bb2.flip(); ByteBuffer bb3 = ByteBuffer.allocate(5); bb3.put("6789".getBytes()); bb3.flip(); IoBuffer ioBuffer = IoBuffer.newInstance(); ioBuffer.add(bb1, bb2).add(bb3); byte seq[] = "abcdefghij".getBytes(); ioBuffer.position(2); ioBuffer.put(seq, 3, 3); ioBuffer.rewind(); byte expected[] = "01def56789".getBytes(); for (int i = 0; i < 6; i++) { assertEquals(expected[i], ioBuffer.get(i)); } }
public IoBuffer put(byte b) { if (readonly) { throw new ReadOnlyBufferException(); } if (position.getPosition() >= limit.getPosition()) { throw new BufferUnderflowException(); } put(position, b); return this; }
IoBuffer { public IoBuffer put(byte b) { if (readonly) { throw new ReadOnlyBufferException(); } if (position.getPosition() >= limit.getPosition()) { throw new BufferUnderflowException(); } put(position, b); return this; } }
IoBuffer { public IoBuffer put(byte b) { if (readonly) { throw new ReadOnlyBufferException(); } if (position.getPosition() >= limit.getPosition()) { throw new BufferUnderflowException(); } put(position, b); return this; } private  IoBuffer(); }
IoBuffer { public IoBuffer put(byte b) { if (readonly) { throw new ReadOnlyBufferException(); } if (position.getPosition() >= limit.getPosition()) { throw new BufferUnderflowException(); } put(position, b); 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(); }
IoBuffer { public IoBuffer put(byte b) { if (readonly) { throw new ReadOnlyBufferException(); } if (position.getPosition() >= limit.getPosition()) { throw new BufferUnderflowException(); } put(position, b); 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();  }