public class DataFile extends Object
| Modifier and Type | Field and Description |
|---|---|
protected File |
file |
protected DataBlock |
lastBlock
Pointer to the last used block.
|
protected org.slf4j.Logger |
logger |
protected RandomAccessFile |
randomAccessFile |
protected TreeSet<DataBlock> |
usedBlocks
Ordered set of used blocks
|
| Modifier and Type | Method and Description |
|---|---|
void |
allocateSpace(DataBlock dataBlock) |
boolean |
checkConsistency() |
void |
close()
Closes the underlying random access file.
|
void |
delete(DataBlock dataBlock,
boolean truncate) |
String |
getFileName() |
int |
getNumAllocated() |
long |
length()
Returns the length of the underlying random access file.
|
byte[] |
read(DataBlock dataBlock) |
DataBlock |
write(byte[] data) |
protected final org.slf4j.Logger logger
protected final RandomAccessFile randomAccessFile
protected DataBlock lastBlock
protected File file
public DataFile(File file) throws FileNotFoundException
FileNotFoundExceptionpublic void allocateSpace(DataBlock dataBlock) throws AllocationException
AllocationExceptionpublic boolean checkConsistency()
public void close()
throws IOException
IOExceptionpublic void delete(DataBlock dataBlock, boolean truncate)
public int getNumAllocated()
public String getFileName()
public long length()
throws IOException
IOExceptionpublic byte[] read(DataBlock dataBlock) throws IOException
IOExceptionpublic DataBlock write(byte[] data) throws IOException
IOExceptionCopyright © 2012. All Rights Reserved.