|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.io.hfile.HFileBlock.Writer
public static class HFileBlock.Writer
Unified version 2 HFile
block writer. The intended usage pattern
is as follows:
HFileBlock.Writer
, providing a compression
algorithm
startWriting(BlockType, boolean)
and get a data stream to
write to
writeHeaderAndData(FSDataOutputStream)
as many times as you need to
store the serialized block into an external stream, or call
getHeaderAndData()
to get it as a byte array.
Constructor Summary | |
---|---|
HFileBlock.Writer(Compression.Algorithm compressionAlgorithm)
|
Method Summary | |
---|---|
int |
blockSizeWritten()
Returns the number of bytes written into the current block so far, or zero if not writing the block at the moment. |
HFileBlock |
getBlockForCaching()
|
byte[] |
getHeaderAndData()
Returns the header or the compressed data (or uncompressed data when not using compression) as a byte array. |
int |
getOnDiskSizeWithHeader()
Returns the on-disk size of the block. |
int |
getOnDiskSizeWithoutHeader()
Returns the on-disk size of the data portion of the block. |
ByteBuffer |
getUncompressedBufferWithHeader()
Similar to getUncompressedBufferWithHeader() but returns a byte
buffer. |
int |
getUncompressedSizeWithHeader()
The uncompressed size of the block data, including header size. |
int |
getUncompressedSizeWithoutHeader()
The uncompressed size of the block data. |
boolean |
isWriting()
|
void |
releaseCompressor()
Releases the compressor this writer uses to compress blocks into the compressor pool. |
DataOutputStream |
startWriting(BlockType newBlockType,
boolean cacheOnWrite)
Starts writing into the block. |
void |
writeBlock(HFileBlock.BlockWritable bw,
org.apache.hadoop.fs.FSDataOutputStream out)
Takes the given HFileBlock.BlockWritable instance, creates a new block of
its appropriate type, writes the writable into this block, and flushes
the block into the output stream. |
void |
writeHeaderAndData(org.apache.hadoop.fs.FSDataOutputStream out)
Similar to writeHeaderAndData(FSDataOutputStream) , but records
the offset of this block so that it can be referenced in the next block
of the same type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HFileBlock.Writer(Compression.Algorithm compressionAlgorithm)
compressionAlgorithm
- compression algorithm to useMethod Detail |
---|
public DataOutputStream startWriting(BlockType newBlockType, boolean cacheOnWrite) throws IOException
IOException
public void writeHeaderAndData(org.apache.hadoop.fs.FSDataOutputStream out) throws IOException
writeHeaderAndData(FSDataOutputStream)
, but records
the offset of this block so that it can be referenced in the next block
of the same type.
out
-
IOException
public byte[] getHeaderAndData() throws IOException
IOException
public void releaseCompressor()
public int getOnDiskSizeWithoutHeader()
public int getOnDiskSizeWithHeader()
public int getUncompressedSizeWithoutHeader()
public int getUncompressedSizeWithHeader()
public boolean isWriting()
public int blockSizeWritten()
public ByteBuffer getUncompressedBufferWithHeader()
getUncompressedBufferWithHeader()
but returns a byte
buffer.
public void writeBlock(HFileBlock.BlockWritable bw, org.apache.hadoop.fs.FSDataOutputStream out) throws IOException
HFileBlock.BlockWritable
instance, creates a new block of
its appropriate type, writes the writable into this block, and flushes
the block into the output stream. The writer is instructed not to buffer
uncompressed bytes for cache-on-write.
bw
- the block-writable object to write as a blockout
- the file system output stream
IOException
public HFileBlock getBlockForCaching()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |