@Override public ByteBuffer slice() { return new DirectByteBuffer(block, remaining(), offset + position, isReadOnly, mapMode); }
/** * Creates a direct byte buffer based on a newly allocated memory block. * * @param capacity * the capacity of the new buffer * @return the created byte buffer. * @throws IllegalArgumentException * if {@code capacity < 0}. */ public static ByteBuffer allocateDirect(int capacity) { if (capacity < 0) { throw new IllegalArgumentException("capacity < 0: " + capacity); } return new DirectByteBuffer(MemoryBlock.allocate(capacity), capacity, 0, false, null); }
private static DirectByteBuffer copy(DirectByteBuffer other, int markOfOther, boolean isReadOnly) { DirectByteBuffer buf = new DirectByteBuffer(other.block, other.capacity(), other.offset, isReadOnly, other.mapMode); buf.limit = other.limit; buf.position = other.position(); buf.mark = markOfOther; return buf; }
int offset = (int) (position - alignment); MemoryBlock block = MemoryBlock.mmap(fd, alignment, size + offset, mapMode); return new DirectByteBuffer(block, (int) size, offset, (mapMode == MapMode.READ_ONLY), mapMode);
@Override public ByteBuffer slice() { return new DirectByteBuffer(block, remaining(), offset + position, isReadOnly, mapMode); }
/** * Creates a direct byte buffer based on a newly allocated memory block. * * @param capacity * the capacity of the new buffer * @return the created byte buffer. * @throws IllegalArgumentException * if {@code capacity < 0}. */ public static ByteBuffer allocateDirect(int capacity) { if (capacity < 0) { throw new IllegalArgumentException("capacity < 0: " + capacity); } return new DirectByteBuffer(MemoryBlock.allocate(capacity), capacity, 0, false, null); }
/** * Creates a direct byte buffer based on a newly allocated memory block. * * @param capacity * the capacity of the new buffer * @return the created byte buffer. * @throws IllegalArgumentException * if {@code capacity < 0}. */ public static ByteBuffer allocateDirect(int capacity) { if (capacity < 0) { throw new IllegalArgumentException("capacity < 0: " + capacity); } return new DirectByteBuffer(MemoryBlock.allocate(capacity), capacity, 0, false, null); }
@Override public ByteBuffer slice() { return new DirectByteBuffer(block, remaining(), offset + position, isReadOnly, mapMode); }
@Override public ByteBuffer slice() { return new DirectByteBuffer(block, remaining(), offset + position, isReadOnly, mapMode); }
@Override public ByteBuffer slice() { return new DirectByteBuffer(block, remaining(), offset + position, isReadOnly, mapMode); }
@Override public ByteBuffer slice() { return new DirectByteBuffer(block, remaining(), offset + position, isReadOnly, mapMode); }
/** * Creates a direct byte buffer based on a newly allocated memory block. * * @param capacity * the capacity of the new buffer * @return the created byte buffer. * @throws IllegalArgumentException * if {@code capacity < 0}. */ public static ByteBuffer allocateDirect(int capacity) { if (capacity < 0) { throw new IllegalArgumentException("capacity < 0: " + capacity); } return new DirectByteBuffer(MemoryBlock.allocate(capacity), capacity, 0, false, null); }
/** * Creates a direct byte buffer based on a newly allocated memory block. * * @param capacity * the capacity of the new buffer * @return the created byte buffer. * @throws IllegalArgumentException * if {@code capacity < 0}. */ public static ByteBuffer allocateDirect(int capacity) { if (capacity < 0) { throw new IllegalArgumentException("capacity < 0: " + capacity); } return new DirectByteBuffer(MemoryBlock.allocate(capacity), capacity, 0, false, null); }
@Override public ByteBuffer slice() { return new DirectByteBuffer(block, remaining(), offset + position, isReadOnly, mapMode); }
private static DirectByteBuffer copy(DirectByteBuffer other, int markOfOther, boolean isReadOnly) { DirectByteBuffer buf = new DirectByteBuffer(other.block, other.capacity(), other.offset, isReadOnly, other.mapMode); buf.limit = other.limit; buf.position = other.position(); buf.mark = markOfOther; return buf; }
private static DirectByteBuffer copy(DirectByteBuffer other, int markOfOther, boolean isReadOnly) { DirectByteBuffer buf = new DirectByteBuffer(other.block, other.capacity(), other.offset, isReadOnly, other.mapMode); buf.limit = other.limit; buf.position = other.position(); buf.mark = markOfOther; return buf; }
private static DirectByteBuffer copy(DirectByteBuffer other, int markOfOther, boolean isReadOnly) { DirectByteBuffer buf = new DirectByteBuffer(other.block, other.capacity(), other.offset, isReadOnly, other.mapMode); buf.limit = other.limit; buf.position = other.position(); buf.mark = markOfOther; return buf; }
private static DirectByteBuffer copy(DirectByteBuffer other, int markOfOther, boolean isReadOnly) { DirectByteBuffer buf = new DirectByteBuffer(other.block, other.capacity(), other.offset, isReadOnly, other.mapMode); buf.limit = other.limit; buf.position = other.position(); buf.mark = markOfOther; return buf; }
private static DirectByteBuffer copy(DirectByteBuffer other, int markOfOther, boolean isReadOnly) { DirectByteBuffer buf = new DirectByteBuffer(other.block, other.capacity(), other.offset, isReadOnly, other.mapMode); buf.limit = other.limit; buf.position = other.position(); buf.mark = markOfOther; return buf; }
private static DirectByteBuffer copy(DirectByteBuffer other, int markOfOther, boolean isReadOnly) { DirectByteBuffer buf = new DirectByteBuffer(other.block, other.capacity(), other.offset, isReadOnly, other.mapMode); buf.limit = other.limit; buf.position = other.position(); buf.mark = markOfOther; return buf; }