org.apache.hadoop.hbase.io.hfile.bucket
Class ByteBufferIOEngine

java.lang.Object
  extended by org.apache.hadoop.hbase.io.hfile.bucket.ByteBufferIOEngine
All Implemented Interfaces:
IOEngine

@InterfaceAudience.Private
public class ByteBufferIOEngine
extends Object
implements IOEngine

IO engine that stores data on the memory using an array of ByteBuffers ByteBufferArray


Constructor Summary
ByteBufferIOEngine(long capacity, boolean direct)
          Construct the ByteBufferIOEngine with the given capacity
 
Method Summary
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ByteBufferIOEngine

public ByteBufferIOEngine(long capacity,
                          boolean direct)
                   throws IOException
Construct the ByteBufferIOEngine with the given capacity

Parameters:
capacity -
direct - true if allocate direct buffer
Throws:
IOException
Method Detail

toString

public String toString()
Overrides:
toString in class Object

isPersistent

public boolean isPersistent()
Memory IO engine is always unable to support persistent storage for the cache

Specified by:
isPersistent in interface IOEngine
Returns:
false

read

public int read(ByteBuffer dstBuffer,
                long offset)
         throws IOException
Transfers data from the buffer array to the given byte buffer

Specified by:
read in interface IOEngine
Parameters:
dstBuffer - the given byte buffer into which bytes are to be written
offset - The offset in the ByteBufferArray of the first byte to be read
Returns:
number of bytes read
Throws:
IOException

write

public void write(ByteBuffer srcBuffer,
                  long offset)
           throws IOException
Transfers data from the given byte buffer to the buffer array

Specified by:
write in interface IOEngine
Parameters:
srcBuffer - the given byte buffer from which bytes are to be read
offset - The offset in the ByteBufferArray of the first byte to be written
Throws:
IOException

sync

public void sync()
No operation for the sync in the memory IO engine

Specified by:
sync in interface IOEngine

shutdown

public void shutdown()
No operation for the shutdown in the memory IO engine

Specified by:
shutdown in interface IOEngine


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.