/** * Construct the ByteBufferIOEngine with the given capacity * @param capacity * @param direct true if allocate direct buffer * @throws IOException */ public ByteBufferIOEngine(long capacity, boolean direct) throws IOException { this.capacity = capacity; this.direct = direct; bufferArray = new ByteBufferArray(capacity, direct); }
/** * Construct the ByteBufferIOEngine with the given capacity * @param capacity * @throws IOException ideally here no exception to be thrown from the allocator */ public ByteBufferIOEngine(long capacity) throws IOException { this.capacity = capacity; ByteBufferAllocator allocator = new ByteBufferAllocator() { @Override public ByteBuffer allocate(long size) throws IOException { return ByteBuffer.allocateDirect((int) size); } }; bufferArray = new ByteBufferArray(capacity, allocator); }
/** * Construct the ByteBufferIOEngine with the given capacity * @param capacity * @param direct true if allocate direct buffer * @throws IOException */ public ByteBufferIOEngine(long capacity, boolean direct) throws IOException { bufferArray = new ByteBufferArray(capacity, direct); }