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.
|
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)
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 DataOutputStream startWriting(BlockType newBlockType) throws IOException
startWriting in class HFileBlock.WriterIOExceptionpublic void write(Cell c) throws IOException
HFileBlock.Writerwrite in class HFileBlock.WriterIOExceptionpublic void writeHeaderAndData(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.writeHeaderAndData in class HFileBlock.Writerout - IOExceptionpublic byte[] getHeaderAndData()
throws IOException
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 ByteBuffer getUncompressedBufferWithHeader()
getUncompressedBufferWithHeader() but returns a byte
buffer.public void writeBlock(HFileBlock.BlockWritable bw, 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.writeBlock in class HFileBlock.Writerbw - the block-writable object to write as a blockout - the file system output streamIOExceptionpublic HFileBlock getBlockForCaching()