Package net.metanotion.io.block
Class FreeListBlock
- java.lang.Object
-
- net.metanotion.io.block.FreeListBlock
-
class FreeListBlock extends Object
On-disk format:Magic number (long) next freelist block page (unsigned int) size (unsigned int) that many free pages (unsigned ints)Always fits on one page. Free page format:Magic number (long)
-
-
Field Summary
Fields Modifier and Type Field Description intpage
-
Constructor Summary
Constructors Constructor Description FreeListBlock(RandomAccessInterface file, int startPage)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPage(int freePage)Adds free page and writes new len to diskbooleanflbck(boolean fix)Recursive.intgetNextPage()static voidinitPage(RandomAccessInterface file, int page)booleanisEmpty()booleanisFull()voidsetNextPage(int nxt)Set and write the next page onlyinttakePage()Takes next page and writes new len to diskStringtoString()voidwriteBlock()
-
-
-
Constructor Detail
-
FreeListBlock
public FreeListBlock(RandomAccessInterface file, int startPage) throws IOException
- Throws:
IOException
-
-
Method Detail
-
writeBlock
public void writeBlock() throws IOException- Throws:
IOException
-
getNextPage
public int getNextPage()
-
setNextPage
public void setNextPage(int nxt) throws IOExceptionSet and write the next page only- Throws:
IOException
-
isEmpty
public boolean isEmpty()
-
isFull
public boolean isFull()
-
addPage
public void addPage(int freePage) throws IOExceptionAdds free page and writes new len to disk- Throws:
IllegalStateException- if fullIOException
-
takePage
public int takePage() throws IOExceptionTakes next page and writes new len to disk- Throws:
IllegalStateException- if emptyIOException
-
initPage
public static void initPage(RandomAccessInterface file, int page) throws IOException
- Throws:
IOException
-
flbck
public boolean flbck(boolean fix) throws IOExceptionRecursive.- Throws:
IOException- Since:
- 0.9.7
-
-