@InterfaceAudience.Private public enum BlockType extends Enum<BlockType>
Modifier and Type | Class and Description |
---|---|
static class |
BlockType.BlockCategory |
Enum Constant and Description |
---|
BLOOM_CHUNK
Bloom filter block, version 2
|
DATA
Data block, both versions
|
DELETE_FAMILY_BLOOM_META
Delete Family Bloom filter metadata, version 2
|
ENCODED_DATA
An encoded data block (e.g.
|
FILE_INFO
File info, version 2
|
GENERAL_BLOOM_META
General Bloom filter metadata, version 2
|
INDEX_V1
Block index magic string in version 1
|
INTERMEDIATE_INDEX
Intermediate-level version 2 index in the non-data block section
|
LEAF_INDEX
Version 2 leaf index block.
|
META
Meta blocks
|
ROOT_INDEX
Root index block, also used for the single-level meta index, version 2
|
TRAILER
Fixed file trailer, both versions (always just a magic string)
|
Modifier and Type | Field and Description |
---|---|
private byte[] |
magic |
static int |
MAGIC_LENGTH |
private BlockType.BlockCategory |
metricCat |
Modifier and Type | Method and Description |
---|---|
BlockType.BlockCategory |
getCategory() |
int |
getId()
Use this instead of
Enum.ordinal() . |
boolean |
isData() |
static 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(ByteBuff buf) |
static BlockType |
read(DataInputStream in) |
void |
readAndCheck(ByteBuffer in)
Reads a magic record of the length
MAGIC_LENGTH from the given
byte buffer and expects it to match this block type. |
void |
readAndCheck(DataInputStream in)
Reads a magic record of the length
MAGIC_LENGTH from the given
stream and expects it to match this block type. |
static BlockType |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static BlockType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
void |
write(ByteBuff buf) |
void |
write(ByteBuffer buf) |
void |
write(DataOutput out) |
void |
writeToStream(OutputStream out) |
public static final BlockType ENCODED_DATA
public static final BlockType LEAF_INDEX
public static final BlockType BLOOM_CHUNK
public static final BlockType INTERMEDIATE_INDEX
public static final BlockType ROOT_INDEX
public static final BlockType GENERAL_BLOOM_META
public static final BlockType DELETE_FAMILY_BLOOM_META
public static final BlockType TRAILER
public static final int MAGIC_LENGTH
private final byte[] magic
private final BlockType.BlockCategory metricCat
public static BlockType[] values()
for (BlockType c : BlockType.values()) System.out.println(c);
public static BlockType valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic int getId()
Enum.ordinal()
. They work exactly the same, except
DATA and ENCODED_DATA get the same id using this method (overridden for
ENCODED_DATA
).public void writeToStream(OutputStream out) throws IOException
IOException
public void write(DataOutput out) throws IOException
IOException
public void write(ByteBuffer buf)
public BlockType.BlockCategory getCategory()
public static BlockType parse(byte[] buf, int offset, int length) throws IOException
IOException
public static BlockType read(DataInputStream in) throws IOException
IOException
public static BlockType read(ByteBuff buf) throws IOException
IOException
public int put(byte[] bytes, int offset)
bytes
- the byte arrayoffset
- position in the arraypublic void readAndCheck(DataInputStream in) throws IOException
MAGIC_LENGTH
from the given
stream and expects it to match this block type.IOException
public void readAndCheck(ByteBuffer in) throws IOException
MAGIC_LENGTH
from the given
byte buffer and expects it to match this block type.IOException
public final boolean isData()
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.