FreeSpaceBitSet
A free space bit set.
| Methods |
|
FreeSpaceBitSet(int firstFreeBlock, int blockSize)
Create a new free space map.
|
|
FreeSpaceBitSet(int firstFreeBlock, int blockSize)
Create a new free space map.
Parameters:
firstFreeBlock - the first free block
blockSize - the block size
|
| long |
allocate(int length)
Allocate a number of blocks and mark them as used.
|
| 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
|
| void |
clear()
Reset the list.
|
| void |
clear()
Reset the list.
|
| void |
free(long pos, int length)
Mark the space as free.
|
| void |
free(long pos, int length)
Mark the space as free.
Parameters:
pos - the position in bytes
length - the number of bytes
|
| int |
getFillRate()
Get the fill rate of the space in percent.
|
| int |
getFillRate()
Get the fill rate of the space in percent. The value 0 means the space is
completely free, and 100 means it is completely full.
Returns:
the fill rate (0 - 100)
|
| long |
getFirstFree()
Get the position of the first free space.
|
| long |
getFirstFree()
Get the position of the first free space.
Returns:
the position.
|
| long |
getLastFree()
Get the position of the last (infinite) free space.
|
| long |
getLastFree()
Get the position of the last (infinite) free space.
Returns:
the position.
|
| boolean |
isFree(long pos, int length)
Check whether one of the blocks is free.
|
| boolean |
isFree(long pos, int length)
Check whether one of the blocks is free.
Parameters:
pos - the position in bytes
length - the number of bytes
Returns:
true if a block is free
|
| boolean |
isUsed(long pos, int length)
Check whether one of the blocks is in use.
|
| boolean |
isUsed(long pos, int length)
Check whether one of the blocks is in use.
Parameters:
pos - the position in bytes
length - the number of bytes
Returns:
true if a block is in use
|
| void |
markUsed(long pos, int length)
Mark the space as in use.
|
| void |
markUsed(long pos, int length)
Mark the space as in use.
Parameters:
pos - the position in bytes
length - the number of bytes
|
| String |
toString()
|
| String |
toString()
|
|