Package org.apache.hadoop.hbase.io.hfile
Enum Class BlockType
- All Implemented Interfaces:
Serializable
,Comparable<BlockType>
,Constable
Various types of HFile blocks. Ordinal values of these enum constants must not be relied upon.
The values in the enum appear in the order they appear in a version 2 HFile.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionBloom filter block, version 2Data block, both versionsDelete Family Bloom filter metadata, version 2An encoded data block (e.g.File info, version 2General Bloom filter metadata, version 2Block index magic string in version 1Intermediate-level version 2 index in the non-data block sectionVersion 2 leaf index block.Meta blocksRoot index block, also used for the single-level meta index, version 2Fixed file trailer, both versions (always just a magic string) -
Field Summary
Modifier and TypeFieldDescriptionprivate final byte[]
static final int
private final BlockType.BlockCategory
-
Constructor Summary
ModifierConstructorDescriptionprivate
BlockType
(String magicStr, BlockType.BlockCategory metricCat) -
Method Summary
Modifier and TypeMethodDescriptionint
getId()
Use this instead ofEnum.ordinal()
.final boolean
isBloom()
Returns whether this block category is bloom filterfinal boolean
isData()
Returns whether this block type is encoded or unencoded data blockfinal boolean
isIndex()
Returns whether this block category is indexstatic BlockType
parse
(byte[] buf, int offset, int length) int
put
(byte[] bytes, int offset) Put the magic record out to the specified byte array position.static BlockType
read
(DataInputStream in) static BlockType
void
Reads a magic record of the lengthMAGIC_LENGTH
from the given stream and expects it to match this block type.void
Reads a magic record of the lengthMAGIC_LENGTH
from the given byte buffer and expects it to match this block type.static BlockType
Returns the enum constant of this class with the specified name.static BlockType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.void
write
(DataOutput out) void
write
(ByteBuffer buf) void
void
-
Enum Constant Details
-
DATA
Data block, both versions -
ENCODED_DATA
An encoded data block (e.g. with prefix compression), version 2 -
LEAF_INDEX
Version 2 leaf index block. Appears in the data block section -
BLOOM_CHUNK
Bloom filter block, version 2 -
META
Meta blocks -
INTERMEDIATE_INDEX
Intermediate-level version 2 index in the non-data block section -
ROOT_INDEX
Root index block, also used for the single-level meta index, version 2 -
FILE_INFO
File info, version 2 -
GENERAL_BLOOM_META
General Bloom filter metadata, version 2 -
DELETE_FAMILY_BLOOM_META
Delete Family Bloom filter metadata, version 2 -
TRAILER
Fixed file trailer, both versions (always just a magic string) -
INDEX_V1
Block index magic string in version 1
-
-
Field Details
-
MAGIC_LENGTH
- See Also:
-
magic
-
metricCat
-
-
Constructor Details
-
BlockType
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getId
Use this instead ofEnum.ordinal()
. They work exactly the same, except DATA and ENCODED_DATA get the same id using this method (overridden forENCODED_DATA
).- Returns:
- block type id from 0 to the number of block types - 1
-
writeToStream
- Throws:
IOException
-
write
- Throws:
IOException
-
write
-
write
-
getCategory
-
parse
- Throws:
IOException
-
read
- Throws:
IOException
-
read
- Throws:
IOException
-
put
Put the magic record out to the specified byte array position.- Parameters:
bytes
- the byte arrayoffset
- position in the array- Returns:
- incremented offset
-
readAndCheck
Reads a magic record of the lengthMAGIC_LENGTH
from the given stream and expects it to match this block type.- Throws:
IOException
-
readAndCheck
Reads a magic record of the lengthMAGIC_LENGTH
from the given byte buffer and expects it to match this block type.- Throws:
IOException
-
isData
Returns whether this block type is encoded or unencoded data block -
isIndex
Returns whether this block category is index -
isBloom
Returns whether this block category is bloom filter
-