@InterfaceAudience.Private public class FixedFileTrailer extends Object
HFile
has a fixed trailer which contains offsets to other
variable parts of the file. Also includes basic metadata on this file. The
trailer size is fixed within a given HFile
format version only, but
we always store the version number as the last four-byte integer of the file.
The version number itself is split into two portions, a major
version and a minor version.
The last three bytes of a file is the major
version and a single preceding byte is the minor number. The major version
determines which readers/writers to use to read/write a hfile while a minor
version determines smaller changes in hfile format that do not need a new
reader/writer type.Modifier and Type | Method and Description |
---|---|
static KeyValue.KVComparator |
createComparator(String comparatorClassName) |
void |
expectAtLeastMajorVersion(int lowerBound) |
void |
expectMajorVersion(int expected) |
void |
expectMinorVersion(int expected) |
String |
getComparatorClassName() |
Compression.Algorithm |
getCompressionCodec() |
int |
getDataIndexCount() |
byte[] |
getEncryptionKey() |
long |
getEntryCount() |
long |
getFileInfoOffset() |
long |
getFirstDataBlockOffset() |
long |
getLastDataBlockOffset() |
long |
getLoadOnOpenDataOffset() |
int |
getMajorVersion()
Returns the major version of this HFile format
|
int |
getMetaIndexCount() |
int |
getMinorVersion()
Returns the minor version of this HFile format
|
int |
getNumDataIndexLevels() |
long |
getTotalUncompressedBytes() |
int |
getTrailerSize() |
long |
getUncompressedDataIndexSize() |
static FixedFileTrailer |
readFromStream(org.apache.hadoop.fs.FSDataInputStream istream,
long fileSize)
Reads a file trailer from the given file.
|
void |
setComparatorClass(Class<? extends KeyValue.KVComparator> klass) |
void |
setCompressionCodec(Compression.Algorithm compressionCodec) |
void |
setDataIndexCount(int dataIndexCount) |
void |
setEncryptionKey(byte[] keyBytes) |
void |
setEntryCount(long newEntryCount) |
void |
setFileInfoOffset(long fileInfoOffset) |
void |
setFirstDataBlockOffset(long firstDataBlockOffset) |
void |
setLastDataBlockOffset(long lastDataBlockOffset) |
void |
setLoadOnOpenOffset(long loadOnOpenDataOffset) |
void |
setMetaIndexCount(int metaIndexCount) |
void |
setNumDataIndexLevels(int numDataIndexLevels) |
void |
setTotalUncompressedBytes(long totalUncompressedBytes) |
void |
setUncompressedDataIndexSize(long uncompressedDataIndexSize) |
String |
toString() |
public int getTrailerSize()
public static FixedFileTrailer readFromStream(org.apache.hadoop.fs.FSDataInputStream istream, long fileSize) throws IOException
istream
- the input stream with the ability to seek. Does not have to
be buffered, as only one read operation is made.fileSize
- the file size. Can be obtained using
FileSystem.getFileStatus(
org.apache.hadoop.fs.Path)
.IOException
- if failed to read from the underlying stream, or the
trailer is corrupted, or the version of the trailer is
unsupportedpublic void expectMajorVersion(int expected)
public void expectMinorVersion(int expected)
public void expectAtLeastMajorVersion(int lowerBound)
public long getFileInfoOffset()
public void setFileInfoOffset(long fileInfoOffset)
public long getLoadOnOpenDataOffset()
public void setLoadOnOpenOffset(long loadOnOpenDataOffset)
public int getDataIndexCount()
public void setDataIndexCount(int dataIndexCount)
public int getMetaIndexCount()
public void setMetaIndexCount(int metaIndexCount)
public long getTotalUncompressedBytes()
public void setTotalUncompressedBytes(long totalUncompressedBytes)
public long getEntryCount()
public void setEntryCount(long newEntryCount)
public Compression.Algorithm getCompressionCodec()
public void setCompressionCodec(Compression.Algorithm compressionCodec)
public int getNumDataIndexLevels()
public void setNumDataIndexLevels(int numDataIndexLevels)
public long getLastDataBlockOffset()
public void setLastDataBlockOffset(long lastDataBlockOffset)
public long getFirstDataBlockOffset()
public void setFirstDataBlockOffset(long firstDataBlockOffset)
public String getComparatorClassName()
public int getMajorVersion()
public int getMinorVersion()
public void setComparatorClass(Class<? extends KeyValue.KVComparator> klass)
public static KeyValue.KVComparator createComparator(String comparatorClassName) throws IOException
IOException
public long getUncompressedDataIndexSize()
public void setUncompressedDataIndexSize(long uncompressedDataIndexSize)
public byte[] getEncryptionKey()
public void setEncryptionKey(byte[] keyBytes)
Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.