java.lang.Comparable<Block>, org.apache.hadoop.io.Writable@Private @Evolving public class Block extends java.lang.Object implements org.apache.hadoop.io.Writable, java.lang.Comparable<Block>
equals(Object),
hashCode(),
compareTo(Block)| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
BLOCK_FILE_PREFIX |
|
static java.util.regex.Pattern |
blockFilePattern |
|
static java.lang.String |
METADATA_EXTENSION |
|
static java.util.regex.Pattern |
metaFilePattern |
|
static java.util.regex.Pattern |
metaOrBlockFilePattern |
| Constructor | Description |
|---|---|
Block() |
|
Block(long blkid) |
|
Block(long blkid,
long len,
long generationStamp) |
|
Block(java.io.File f,
long len,
long genstamp) |
Find the blockid from the given filename
|
Block(Block blk) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
appendStringTo(java.lang.StringBuilder sb) |
|
int |
compareTo(Block b) |
Compares this Block with the specified Block for order.
|
boolean |
equals(java.lang.Object obj) |
Indicates whether some Block is "equal to" this one.
|
static long |
filename2id(java.lang.String name) |
|
long |
getBlockId() |
|
static long |
getBlockId(java.lang.String metaOrBlockFile) |
Get the blockId from the name of the meta or block file
|
java.lang.String |
getBlockName() |
Get the block name.
|
long |
getGenerationStamp() |
|
static long |
getGenerationStamp(java.lang.String metaFile) |
Get generation stamp from the name of the metafile name
|
long |
getNumBytes() |
|
int |
hashCode() |
Returns a hash code value for the Block.
|
static boolean |
isBlockFilename(java.io.File f) |
|
static boolean |
isMetaFilename(java.lang.String name) |
|
static boolean |
matchingIdAndGenStamp(Block a,
Block b) |
A helper function to determine if two blocks are equal, based on the block
ID and the generation stamp.
|
static java.io.File |
metaToBlockFile(java.io.File metaFile) |
|
void |
readFields(java.io.DataInput in) |
|
void |
readId(java.io.DataInput in) |
|
void |
set(long blkid,
long len,
long genStamp) |
|
void |
setBlockId(long bid) |
|
void |
setGenerationStamp(long stamp) |
|
void |
setNumBytes(long len) |
|
java.lang.String |
toString() |
Get the block name.
|
static java.lang.String |
toString(Block b) |
A helper method to output the string representation of the Block portion of
a derived class' instance.
|
void |
write(java.io.DataOutput out) |
|
void |
writeId(java.io.DataOutput out) |
public static final java.lang.String BLOCK_FILE_PREFIX
public static final java.lang.String METADATA_EXTENSION
public static final java.util.regex.Pattern blockFilePattern
public static final java.util.regex.Pattern metaFilePattern
public static final java.util.regex.Pattern metaOrBlockFilePattern
public Block()
public Block(long blkid,
long len,
long generationStamp)
public Block(long blkid)
public Block(Block blk)
public Block(java.io.File f,
long len,
long genstamp)
public static boolean isBlockFilename(java.io.File f)
public static long filename2id(java.lang.String name)
public static boolean isMetaFilename(java.lang.String name)
public static java.io.File metaToBlockFile(java.io.File metaFile)
public static long getGenerationStamp(java.lang.String metaFile)
public static long getBlockId(java.lang.String metaOrBlockFile)
public void set(long blkid,
long len,
long genStamp)
public long getBlockId()
public void setBlockId(long bid)
public java.lang.String getBlockName()
blk_1, blk_2, blk_3, etc.
public long getNumBytes()
public void setNumBytes(long len)
public long getGenerationStamp()
public void setGenerationStamp(long stamp)
public static java.lang.String toString(Block b)
b - the target objectpublic java.lang.String toString()
blk_block-id_generation, blk_1_1, blk_1_2, blk_2_1, etc.
toString in class java.lang.Objectpublic void appendStringTo(java.lang.StringBuilder sb)
public void write(java.io.DataOutput out)
throws java.io.IOException
write in interface org.apache.hadoop.io.Writablejava.io.IOExceptionpublic void readFields(java.io.DataInput in)
throws java.io.IOException
readFields in interface org.apache.hadoop.io.Writablejava.io.IOExceptionpublic void writeId(java.io.DataOutput out)
throws java.io.IOException
java.io.IOExceptionpublic void readId(java.io.DataInput in)
throws java.io.IOException
java.io.IOExceptionpublic int compareTo(@Nonnull
Block b)
compareTo in interface java.lang.Comparable<Block>b - the Block to be comparedpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the reference object with which to compare.public int hashCode()
hashCode in class java.lang.Objectequals(Object)public static boolean matchingIdAndGenStamp(Block a, Block b)
a - an objectb - an object to be compared with a for equalitytrue if the blocks are deeply equal to each other and
false otherwiseBlockCopyright © 2008–2025 Apache Software Foundation. All rights reserved.