public static final class TestHFileBlockCompatibility.Writer extends HFileBlock.Writer
HFileBlock.Writer.BufferGrabbingByteArrayOutputStream| Constructor and Description |
|---|
Writer(Compression.Algorithm compressionAlgorithm,
HFileDataBlockEncoder dataBlockEncoder,
boolean includesMemstoreTS,
boolean includesTag) |
Writer(HFileDataBlockEncoder dataBlockEncoder,
HFileContext meta) |
| Modifier and Type | Method and Description |
|---|---|
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()
Creates a new HFileBlock.
|
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.
|
java.nio.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.
|
java.io.DataOutputStream |
startWriting(BlockType newBlockType)
Starts writing into the block.
|
void |
write(Cell c)
Writes the Cell to this block
|
void |
writeBlock(HFileBlock.BlockWritable bw,
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(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. |
finishBlockAndWriteHeaderAndData, getBlockForCaching, releasepublic Writer(Compression.Algorithm compressionAlgorithm, HFileDataBlockEncoder dataBlockEncoder, boolean includesMemstoreTS, boolean includesTag)
public Writer(HFileDataBlockEncoder dataBlockEncoder, HFileContext meta)
public java.io.DataOutputStream startWriting(BlockType newBlockType) throws java.io.IOException
startWriting in class HFileBlock.Writerjava.io.IOExceptionpublic void write(Cell c) throws java.io.IOException
HFileBlock.Writerwrite in class HFileBlock.Writerjava.io.IOExceptionpublic void writeHeaderAndData(FSDataOutputStream out)
throws java.io.IOException
writeHeaderAndData(FSDataOutputStream), but records
the offset of this block so that it can be referenced in the next block
of the same type.writeHeaderAndData in class HFileBlock.Writerout - java.io.IOExceptionpublic byte[] getHeaderAndData()
throws java.io.IOException
java.io.IOExceptionpublic void releaseCompressor()
public int getOnDiskSizeWithoutHeader()
public int getOnDiskSizeWithHeader()
public int getUncompressedSizeWithoutHeader()
public int getUncompressedSizeWithHeader()
public boolean isWriting()
isWriting in class HFileBlock.Writerpublic int blockSizeWritten()
blockSizeWritten in class HFileBlock.Writerpublic java.nio.ByteBuffer getUncompressedBufferWithHeader()
getUncompressedBufferWithHeader() but returns a byte
buffer.public void writeBlock(HFileBlock.BlockWritable bw, FSDataOutputStream out) throws java.io.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.writeBlock in class HFileBlock.Writerbw - the block-writable object to write as a blockout - the file system output streamjava.io.IOExceptionpublic HFileBlock getBlockForCaching()