@InterfaceAudience.Private public class ByteBufferIOEngine extends Object implements IOEngine
ByteBufferArray
Modifier and Type | Field and Description |
---|---|
private ByteBufferArray |
bufferArray |
private long |
capacity |
private boolean |
direct |
Constructor and Description |
---|
ByteBufferIOEngine(long capacity,
boolean direct)
Construct the ByteBufferIOEngine with the given capacity
|
Modifier and Type | Method and Description |
---|---|
boolean |
isPersistent()
Memory IO engine is always unable to support persistent storage for the
cache
|
int |
read(ByteBuffer dstBuffer,
long offset)
Transfers data from the buffer array to the given byte buffer
|
void |
shutdown()
No operation for the shutdown in the memory IO engine
|
void |
sync()
No operation for the sync in the memory IO engine
|
String |
toString() |
void |
write(ByteBuffer srcBuffer,
long offset)
Transfers data from the given byte buffer to the buffer array
|
private ByteBufferArray bufferArray
private final long capacity
private final boolean direct
public ByteBufferIOEngine(long capacity, boolean direct) throws IOException
capacity
- direct
- true if allocate direct bufferIOException
public boolean isPersistent()
isPersistent
in interface IOEngine
public int read(ByteBuffer dstBuffer, long offset) throws IOException
read
in interface IOEngine
dstBuffer
- the given byte buffer into which bytes are to be writtenoffset
- The offset in the ByteBufferArray of the first byte to be
readIOException
public void write(ByteBuffer srcBuffer, long offset) throws IOException
write
in interface IOEngine
srcBuffer
- the given byte buffer from which bytes are to be readoffset
- The offset in the ByteBufferArray of the first byte to be
writtenIOException
public void sync()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.