@InterfaceAudience.Private public class FileIOEngine extends Object implements IOEngine
| Modifier and Type | Field and Description |
|---|---|
private FileChannel |
fileChannel |
private static org.apache.commons.logging.Log |
LOG |
private String |
path |
private RandomAccessFile |
raf |
private long |
size |
| Constructor and Description |
|---|
FileIOEngine(String filePath,
long fileSize) |
| Modifier and Type | Method and Description |
|---|---|
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
|
private static final org.apache.commons.logging.Log LOG
private final RandomAccessFile raf
private final FileChannel fileChannel
private final String path
private long size
public FileIOEngine(String filePath, long fileSize) throws IOException
IOExceptionpublic boolean isPersistent()
isPersistent in interface IOEnginepublic int read(ByteBuffer dstBuffer, long offset) throws IOException
read in interface IOEnginedstBuffer - the given byte buffer into which bytes are to be writtenoffset - The offset in the file where the first byte to be readIOExceptionpublic void write(ByteBuffer srcBuffer, long offset) throws IOException
write in interface IOEnginesrcBuffer - the given byte buffer from which bytes are to be readoffset - The offset in the file where the first byte to be writtenIOExceptionpublic void sync()
throws IOException
sync in interface IOEngineIOExceptionCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.