Constructor and Description |
---|
BlockPageId(long blockId,
long pageIndex,
long blockSize)
Creates an instance with a block ID as a
long . |
BlockPageId(String blockId,
long pageIndex,
long blockSize) |
Modifier and Type | Method and Description |
---|---|
static BlockPageId |
downcast(PageId pageId)
Try to downcast a
PageId to a BlockPageId . |
boolean |
equals(Object o) |
static String |
fileIdOf(long blockId,
long blockSize) |
long |
getBlockId() |
long |
getBlockSize() |
int |
hashCode() |
static BlockPageId |
newTempPage(long blockId,
long pageIndex)
Creates a new page of the temporary block.
|
static long |
parseBlockId(String fileId) |
static long |
parseBlockSize(String fileId) |
static String |
tempFileIdOf(long blockId) |
getFileId, getPageIndex, toString
public BlockPageId(String blockId, long pageIndex, long blockSize)
blockId
- string representation of the block ID in base 10pageIndex
- index of the page in the blockblockSize
- block sizeNumberFormatException
- when blockId
cannot be parsed as a long
public BlockPageId(long blockId, long pageIndex, long blockSize)
long
.blockId
- the block IDpageIndex
- index of the page in the blockblockSize
- block sizepublic static BlockPageId newTempPage(long blockId, long pageIndex)
blockId
- pageIndex
- public static String fileIdOf(long blockId, long blockSize)
blockId
- blockSize
- public static String tempFileIdOf(long blockId)
blockId
- public static long parseBlockId(String fileId)
fileId
- IllegalArgumentException
- when the fileId does not contain a valid block IDpublic static long parseBlockSize(String fileId)
fileId
- IllegalArgumentException
- when the fileId does not contain a valid block sizepublic long getBlockId()
public long getBlockSize()
public static BlockPageId downcast(PageId pageId)
PageId
to a BlockPageId
. If the object is already a block
page ID, then it is immediately returned. Otherwise, attempt to parse the fileId
of
the page if the encoded file name matches a block and contains all necessary metadata.pageId
- the page ID to downcastIllegalArgumentException
- if the page ID cannot be cast to a block page IDCopyright © 2023. All Rights Reserved.