net.dontdrinkandroot.cache.impl.disk.indexed.storage
Class DataFile
java.lang.Object
net.dontdrinkandroot.cache.impl.disk.indexed.storage.DataFile
public class DataFile
- extends Object
- Author:
- Philip W. Sorst
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected final org.slf4j.Logger logger
randomAccessFile
protected final RandomAccessFile randomAccessFile
usedBlocks
protected final TreeSet<DataBlock> usedBlocks
- Ordered set of used blocks
lastBlock
protected DataBlock lastBlock
- Pointer to the last used block.
file
protected File file
DataFile
public DataFile(File file)
throws FileNotFoundException
- Throws:
FileNotFoundException
allocateSpace
public void allocateSpace(DataBlock dataBlock)
throws AllocationException
- Throws:
AllocationException
checkConsistency
public boolean checkConsistency()
close
public void close()
throws IOException
- Closes the underlying random access file.
- Throws:
IOException
delete
public void delete(DataBlock dataBlock,
boolean truncate)
getNumAllocated
public int getNumAllocated()
getFileName
public String getFileName()
length
public long length()
throws IOException
- Returns the length of the underlying random access file.
- Throws:
IOException
read
public byte[] read(DataBlock dataBlock)
throws IOException
- Throws:
IOException
write
public DataBlock write(byte[] data)
throws IOException
- Throws:
IOException
Copyright © 2013 dontdrinkandroot. All Rights Reserved.