Package org.h2.test.store
Class FreeSpaceTree
- java.lang.Object
-
- org.h2.test.store.FreeSpaceTree
-
public class FreeSpaceTree extends java.lang.ObjectA list that maintains ranges of free space (in blocks) in a file.
-
-
Constructor Summary
Constructors Constructor Description FreeSpaceTree(int firstFreeBlock, int blockSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longallocate(int length)Allocate a number of blocks and mark them as used.voidclear()Reset the list.voidfree(long pos, int length)Mark the space as free.voidmarkUsed(long pos, int length)Mark the space as in use.java.lang.StringtoString()
-
-
-
Method Detail
-
clear
public void clear()
Reset the list.
-
allocate
public long allocate(int length)
Allocate a number of blocks and mark them as used.- Parameters:
length- the number of bytes to allocate- Returns:
- the start position in bytes
-
markUsed
public void markUsed(long pos, int length)Mark the space as in use.- Parameters:
pos- the position in byteslength- the number of bytes
-
free
public void free(long pos, int length)Mark the space as free.- Parameters:
pos- the position in byteslength- the number of bytes
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-