public ByteBuffer slice () { DirectReadWriteByteBuffer slice = new DirectReadWriteByteBuffer(byteArray.buffer(), remaining(), byteArray.byteOffset() + position); slice.order = order; return slice; } }
@Override public ByteOrder order () { return byteBuffer.order(); }
static DirectReadWriteByteBuffer copy (DirectByteBuffer other, int markOfOther) { DirectReadWriteByteBuffer buf = new DirectReadWriteByteBuffer(other.byteArray.buffer(), other.capacity(), other.byteArray.byteOffset()); buf.limit = other.limit(); buf.position = other.position(); buf.mark = markOfOther; buf.order(other.order()); return buf; }
public ByteBuffer put (byte[] src, int off, int len) { if (off < 0 || len < 0 || (long)off + (long)len > src.length) { throw new IndexOutOfBoundsException(); } if (len > remaining()) { throw new BufferOverflowException(); } if (isReadOnly()) { throw new ReadOnlyBufferException(); } for (int i = 0; i < len; i++) { byteArray.set(i + position, src[off + i]); } position += len; return this; }
@Override public IntBuffer duplicate () { DirectReadWriteIntBufferAdapter buf = new DirectReadWriteIntBufferAdapter((DirectReadWriteByteBuffer)byteBuffer.duplicate()); buf.limit = limit; buf.position = position; buf.mark = mark; return buf; }
/** Returns a new direct byte buffer with the specified capacity. * * @param capacity The capacity of the new buffer * @return A new direct byte buffer with the specified capacity. */ public static ByteBuffer newDirectByteBuffer (int capacity) { return new DirectReadWriteByteBuffer(capacity); }
public ByteBuffer duplicate () { return copy(this, mark); }
@Override public ByteOrder order () { return byteBuffer.order(); }
static DirectReadWriteByteBuffer copy (DirectByteBuffer other, int markOfOther) { DirectReadWriteByteBuffer buf = new DirectReadWriteByteBuffer(other.byteArray.buffer(), other.capacity(), other.byteArray.byteOffset()); buf.limit = other.limit(); buf.position = other.position(); buf.mark = markOfOther; buf.order(other.order()); return buf; }
public ByteBuffer put (byte[] src, int off, int len) { if (off < 0 || len < 0 || (long)off + (long)len > src.length) { throw new IndexOutOfBoundsException(); } if (len > remaining()) { throw new BufferOverflowException(); } if (isReadOnly()) { throw new ReadOnlyBufferException(); } for (int i = 0; i < len; i++) { byteArray.set(i + position, src[off + i]); } position += len; return this; }
@Override public ShortBuffer duplicate () { DirectReadWriteShortBufferAdapter buf = new DirectReadWriteShortBufferAdapter( (DirectReadWriteByteBuffer)byteBuffer.duplicate()); buf.limit = limit; buf.position = position; buf.mark = mark; return buf; }
/** Returns a new direct byte buffer with the specified capacity. * * @param capacity The capacity of the new buffer * @return A new direct byte buffer with the specified capacity. */ public static ByteBuffer newDirectByteBuffer (int capacity) { return new DirectReadWriteByteBuffer(capacity); }
public ByteBuffer duplicate () { return copy(this, mark); }