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

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

@InterfaceAudience.Private
public class FileIOEngine
extends Object
implements IOEngine

IO engine that stores data to a file on the local file system.


Constructor Summary
FileIOEngine(String filePath, long fileSize)
           
 
Method Summary
 boolean isPersistent()
          File IO engine is always able to support persistent storage for the cache
 int read(ByteBuffer dstBuffer, long offset)
          Transfers data from file to the given byte buffer
 void shutdown()
          Close the file
 void sync()
          Sync the data to file after writing
 String toString()
           
 void write(ByteBuffer srcBuffer, long offset)
          Transfers data from the given byte buffer to file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileIOEngine

public FileIOEngine(String filePath,
                    long fileSize)
             throws IOException
Throws:
IOException
Method Detail

toString

public String toString()
Overrides:
toString in class Object

isPersistent

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

Specified by:
isPersistent in interface IOEngine
Returns:
true

read

public int read(ByteBuffer dstBuffer,
                long offset)
         throws IOException
Transfers data from file 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 file where 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 file

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

sync

public void sync()
          throws IOException
Sync the data to file after writing

Specified by:
sync in interface IOEngine
Throws:
IOException

shutdown

public void shutdown()
Close the file

Specified by:
shutdown in interface IOEngine


Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.