@InterfaceAudience.Private public class FileIOEngine extends Object implements PersistentIOEngine
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
FILE_DELIMITER |
| 构造器和说明 |
|---|
FileIOEngine(long capacity,
String... filePaths) |
| 限定符和类型 | 方法和说明 |
|---|---|
byte[] |
calculateChecksum(String algorithm)
Using an encryption algorithm to calculate a checksum, the default encryption algorithm is MD5
|
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() |
boolean |
verifyFileIntegrity(byte[] persistentChecksum,
String algorithm)
Verify cache files's integrity
|
void |
write(ByteBuffer srcBuffer,
long offset)
Transfers data from the given byte buffer to file
|
public FileIOEngine(long capacity,
String... filePaths)
throws IOException
IOExceptionpublic boolean verifyFileIntegrity(byte[] persistentChecksum,
String algorithm)
PersistentIOEngineverifyFileIntegrity 在接口中 PersistentIOEnginepersistentChecksum - the persistent checksumalgorithm - which algorithm to calculate checksumpublic boolean isPersistent()
isPersistent 在接口中 IOEnginepublic int read(ByteBuffer dstBuffer, long offset) throws IOException
read 在接口中 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 在接口中 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 在接口中 IOEngineIOExceptionpublic byte[] calculateChecksum(String algorithm)
PersistentIOEnginecalculateChecksum 在接口中 PersistentIOEnginealgorithm - which algorithm to calculate checksumCopyright © 2007–2021 The Apache Software Foundation. All rights reserved.