@InterfaceAudience.Private @InterfaceStability.Evolving public class Block extends Object implements Writable, Comparable<Block>
Modifier and Type | Field and Description |
---|---|
static String |
BLOCK_FILE_PREFIX |
static Pattern |
blockFilePattern |
static String |
METADATA_EXTENSION |
static Pattern |
metaFilePattern |
Constructor and Description |
---|
Block() |
Block(Block blk) |
Block(File f,
long len,
long genstamp)
Find the blockid from the given filename
|
Block(long blkid) |
Block(long blkid,
long len,
long generationStamp) |
Modifier and Type | Method and Description |
---|---|
void |
appendStringTo(StringBuilder sb) |
int |
compareTo(Block b) |
boolean |
equals(Object o) |
static long |
filename2id(String name) |
long |
getBlockId() |
static long |
getBlockId(String metaFile)
Get the blockId from the name of the metafile name
|
String |
getBlockName() |
long |
getGenerationStamp() |
static long |
getGenerationStamp(String metaFile)
Get generation stamp from the name of the metafile name
|
long |
getNumBytes() |
int |
hashCode() |
static boolean |
isBlockFilename(File f) |
static boolean |
isMetaFilename(String name) |
static boolean |
matchingIdAndGenStamp(Block a,
Block b) |
void |
readFields(DataInput in)
Deserialize the fields of this object from
in . |
void |
readId(DataInput in) |
void |
set(long blkid,
long len,
long genStamp) |
void |
setBlockId(long bid) |
void |
setGenerationStamp(long stamp) |
void |
setNumBytes(long len) |
String |
toString() |
void |
write(DataOutput out)
Serialize the fields of this object to
out . |
void |
writeId(DataOutput out) |
public static final String BLOCK_FILE_PREFIX
public static final String METADATA_EXTENSION
public static final Pattern blockFilePattern
public static final Pattern metaFilePattern
public Block()
public Block(long blkid, long len, long generationStamp)
public Block(long blkid)
public Block(Block blk)
public Block(File f, long len, long genstamp)
public static boolean isBlockFilename(File f)
public static long filename2id(String name)
public static boolean isMetaFilename(String name)
public static long getGenerationStamp(String metaFile)
public static long getBlockId(String metaFile)
public void set(long blkid, long len, long genStamp)
public long getBlockId()
public void setBlockId(long bid)
public String getBlockName()
public long getNumBytes()
public void setNumBytes(long len)
public long getGenerationStamp()
public void setGenerationStamp(long stamp)
public void appendStringTo(StringBuilder sb)
public void write(DataOutput out) throws IOException
Writable
out
.write
in interface Writable
out
- DataOuput
to serialize this object into.IOException
public void readFields(DataInput in) throws IOException
Writable
in
.
For efficiency, implementations should attempt to re-use storage in the existing object where possible.
readFields
in interface Writable
in
- DataInput
to deseriablize this object from.IOException
public void writeId(DataOutput out) throws IOException
IOException
public void readId(DataInput in) throws IOException
IOException
public int compareTo(Block b)
compareTo
in interface Comparable<Block>
public static boolean matchingIdAndGenStamp(Block a, Block b)
Copyright © 2013 Apache Software Foundation. All rights reserved.