blob: d8ebaebd2a14e4280b0a0aec1e83c234c0164d66 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>HFileBlock.Writer (Apache HBase 4.0.0-alpha-1-SNAPSHOT API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="declaration: package: org.apache.hadoop.hbase.io.hfile, class: HFileBlock, class: Writer">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../../script-dir/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="../../../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var evenRowColor = "even-row-color";
var oddRowColor = "odd-row-color";
var tableTab = "table-tab";
var activeTableTab = "active-table-tab";
var pathtoroot = "../../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="class-use/HFileBlock.Writer.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html#class">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div>
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li><a href="#nested-class-summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field-summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor-summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li><a href="#field-detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor-detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-detail">Method</a></li>
</ul>
</div>
<div class="nav-list-search"><label for="search-input">SEARCH:</label>
<input type="text" id="search-input" value="search" disabled="disabled">
<input type="reset" id="reset-button" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">org.apache.hadoop.hbase.io.hfile</a></div>
<h1 title="Class HFileBlock.Writer" class="title">Class HFileBlock.Writer</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a>
<div class="inheritance">org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer</div>
</div>
<section class="class-description" id="class-description">
<dl class="notes">
<dt>All Implemented Interfaces:</dt>
<dd><code><a href="../../regionserver/ShipperListener.html" title="interface in org.apache.hadoop.hbase.regionserver">ShipperListener</a></code></dd>
</dl>
<dl class="notes">
<dt>Enclosing class:</dt>
<dd><a href="HFileBlock.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileBlock</a></dd>
</dl>
<hr>
<div class="type-signature"><span class="modifiers">static class </span><span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.html#line-745">HFileBlock.Writer</a></span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>
implements <a href="../../regionserver/ShipperListener.html" title="interface in org.apache.hadoop.hbase.regionserver">ShipperListener</a></span></div>
<div class="block">Unified version 2 <a href="HFile.html" title="class in org.apache.hadoop.hbase.io.hfile"><code>HFile</code></a> block writer. The intended usage pattern is as follows:
<ol>
<li>Construct an <a href="HFileBlock.Writer.html" title="class in org.apache.hadoop.hbase.io.hfile"><code>HFileBlock.Writer</code></a>, providing a compression algorithm.
<li>Call <a href="#startWriting(org.apache.hadoop.hbase.io.hfile.BlockType)"><code>startWriting(org.apache.hadoop.hbase.io.hfile.BlockType)</code></a> and get a data stream to write to.
<li>Write your data into the stream.
<li>Call Writer#writeHeaderAndData(FSDataOutputStream) as many times as you need to. store the
serialized block into an external stream.
<li>Repeat to write more blocks.
</ol>
<p></div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<li>
<section class="nested-class-summary" id="nested-class-summary">
<h2>Nested Class Summary</h2>
<div class="caption"><span>Nested Classes</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Class</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>private static enum&nbsp;</code></div>
<div class="col-second even-row-color"><code><a href="HFileBlock.Writer.State.html" class="type-name-link" title="enum class in org.apache.hadoop.hbase.io.hfile">HFileBlock.Writer.State</a></code></div>
<div class="col-last even-row-color">&nbsp;</div>
</div>
</section>
</li>
<!-- =========== FIELD SUMMARY =========== -->
<li>
<section class="field-summary" id="field-summary">
<h2>Field Summary</h2>
<div class="caption"><span>Fields</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Field</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>private final <a href="../ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io">ByteBuffAllocator</a></code></div>
<div class="col-second even-row-color"><code><a href="#allocator" class="member-name-link">allocator</a></code></div>
<div class="col-last even-row-color">&nbsp;</div>
<div class="col-first odd-row-color"><code>private <a href="../ByteArrayOutputStream.html" title="class in org.apache.hadoop.hbase.io">ByteArrayOutputStream</a></code></div>
<div class="col-second odd-row-color"><code><a href="#baosInMemory" class="member-name-link">baosInMemory</a></code></div>
<div class="col-last odd-row-color">
<div class="block">The stream we use to accumulate data into a block in an uncompressed format.</div>
</div>
<div class="col-first even-row-color"><code>private <a href="BlockType.html" title="enum class in org.apache.hadoop.hbase.io.hfile">BlockType</a></code></div>
<div class="col-second even-row-color"><code><a href="#blockType" class="member-name-link">blockType</a></code></div>
<div class="col-last even-row-color">
<div class="block">Current block type.</div>
</div>
<div class="col-first odd-row-color"><code>private <a href="BlockCompressedSizePredicator.html" title="interface in org.apache.hadoop.hbase.io.hfile">BlockCompressedSizePredicator</a></code></div>
<div class="col-second odd-row-color"><code><a href="#compressedSizePredicator" class="member-name-link">compressedSizePredicator</a></code></div>
<div class="col-last odd-row-color">&nbsp;</div>
<div class="col-first even-row-color"><code>private final <a href="HFileDataBlockEncoder.html" title="interface in org.apache.hadoop.hbase.io.hfile">HFileDataBlockEncoder</a></code></div>
<div class="col-second even-row-color"><code><a href="#dataBlockEncoder" class="member-name-link">dataBlockEncoder</a></code></div>
<div class="col-last even-row-color">
<div class="block">Data block encoder used for data blocks</div>
</div>
<div class="col-first odd-row-color"><code>private <a href="../encoding/HFileBlockEncodingContext.html" title="interface in org.apache.hadoop.hbase.io.encoding">HFileBlockEncodingContext</a></code></div>
<div class="col-second odd-row-color"><code><a href="#dataBlockEncodingCtx" class="member-name-link">dataBlockEncodingCtx</a></code></div>
<div class="col-last odd-row-color">&nbsp;</div>
<div class="col-first even-row-color"><code>private <a href="../encoding/HFileBlockDefaultEncodingContext.html" title="class in org.apache.hadoop.hbase.io.encoding">HFileBlockDefaultEncodingContext</a></code></div>
<div class="col-second even-row-color"><code><a href="#defaultBlockEncodingCtx" class="member-name-link">defaultBlockEncodingCtx</a></code></div>
<div class="col-last even-row-color">
<div class="block">block encoding context for non-data blocks</div>
</div>
<div class="col-first odd-row-color"><code>private <a href="HFileContext.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileContext</a></code></div>
<div class="col-second odd-row-color"><code><a href="#fileContext" class="member-name-link">fileContext</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Meta data that holds information about the hfileblock</div>
</div>
<div class="col-first even-row-color"><code>private int</code></div>
<div class="col-second even-row-color"><code><a href="#maxSizeUnCompressed" class="member-name-link">maxSizeUnCompressed</a></code></div>
<div class="col-last even-row-color">&nbsp;</div>
<div class="col-first odd-row-color"><code>private <a href="../ByteArrayOutputStream.html" title="class in org.apache.hadoop.hbase.io">ByteArrayOutputStream</a></code></div>
<div class="col-second odd-row-color"><code><a href="#onDiskBlockBytesWithHeader" class="member-name-link">onDiskBlockBytesWithHeader</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Bytes to be written to the file system, including the header.</div>
</div>
<div class="col-first even-row-color"><code>private byte[]</code></div>
<div class="col-second even-row-color"><code><a href="#onDiskChecksum" class="member-name-link">onDiskChecksum</a></code></div>
<div class="col-last even-row-color">
<div class="block">The size of the checksum data on disk.</div>
</div>
<div class="col-first odd-row-color"><code>private long</code></div>
<div class="col-second odd-row-color"><code><a href="#prevOffset" class="member-name-link">prevOffset</a></code></div>
<div class="col-last odd-row-color">
<div class="block">The offset of the previous block of the same type</div>
</div>
<div class="col-first even-row-color"><code>private long[]</code></div>
<div class="col-second even-row-color"><code><a href="#prevOffsetByType" class="member-name-link">prevOffsetByType</a></code></div>
<div class="col-last even-row-color">
<div class="block">Offset of previous block by block type.</div>
</div>
<div class="col-first odd-row-color"><code>private long</code></div>
<div class="col-second odd-row-color"><code><a href="#startOffset" class="member-name-link">startOffset</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Current block's start offset in the <a href="HFile.html" title="class in org.apache.hadoop.hbase.io.hfile"><code>HFile</code></a>.</div>
</div>
<div class="col-first even-row-color"><code>private <a href="HFileBlock.Writer.State.html" title="enum class in org.apache.hadoop.hbase.io.hfile">HFileBlock.Writer.State</a></code></div>
<div class="col-second even-row-color"><code><a href="#state" class="member-name-link">state</a></code></div>
<div class="col-last even-row-color">
<div class="block">Writer state.</div>
</div>
<div class="col-first odd-row-color"><code>private <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/DataOutputStream.html" title="class or interface in java.io" class="external-link">DataOutputStream</a></code></div>
<div class="col-second odd-row-color"><code><a href="#userDataStream" class="member-name-link">userDataStream</a></code></div>
<div class="col-last odd-row-color">
<div class="block">A stream that we write uncompressed bytes to, which compresses them and writes them to
<a href="#baosInMemory"><code>baosInMemory</code></a>.</div>
</div>
</div>
</section>
</li>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor-summary">
<h2>Constructor Summary</h2>
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(org.apache.hadoop.conf.Configuration,org.apache.hadoop.hbase.io.hfile.HFileDataBlockEncoder,org.apache.hadoop.hbase.io.hfile.HFileContext)" class="member-name-link">Writer</a><wbr>(org.apache.hadoop.conf.Configuration&nbsp;conf,
<a href="HFileDataBlockEncoder.html" title="interface in org.apache.hadoop.hbase.io.hfile">HFileDataBlockEncoder</a>&nbsp;dataBlockEncoder,
<a href="HFileContext.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileContext</a>&nbsp;fileContext)</code></div>
<div class="col-last even-row-color">&nbsp;</div>
<div class="col-constructor-name odd-row-color"><code><a href="#%3Cinit%3E(org.apache.hadoop.conf.Configuration,org.apache.hadoop.hbase.io.hfile.HFileDataBlockEncoder,org.apache.hadoop.hbase.io.hfile.HFileContext,org.apache.hadoop.hbase.io.ByteBuffAllocator,int)" class="member-name-link">Writer</a><wbr>(org.apache.hadoop.conf.Configuration&nbsp;conf,
<a href="HFileDataBlockEncoder.html" title="interface in org.apache.hadoop.hbase.io.hfile">HFileDataBlockEncoder</a>&nbsp;dataBlockEncoder,
<a href="HFileContext.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileContext</a>&nbsp;fileContext,
<a href="../ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io">ByteBuffAllocator</a>&nbsp;allocator,
int&nbsp;maxSizeUnCompressed)</code></div>
<div class="col-last odd-row-color">&nbsp;</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#beforeShipped()" class="member-name-link">beforeShipped</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">The action that needs to be performed before <a href="../../regionserver/Shipper.html#shipped()"><code>Shipper.shipped()</code></a> is performed</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#blockSizeWritten()" class="member-name-link">blockSizeWritten</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the number of bytes written into the current block so far, or zero if not writing the
block at the moment.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#checkBoundariesWithPredicate()" class="member-name-link">checkBoundariesWithPredicate</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private <a href="../../nio/ByteBuff.html" title="class in org.apache.hadoop.hbase.nio">ByteBuff</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#cloneOnDiskBufferWithHeader()" class="member-name-link">cloneOnDiskBufferWithHeader</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Clones the header followed by the on-disk (compressed/encoded/encrypted) data.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>(package private) <a href="../../nio/ByteBuff.html" title="class in org.apache.hadoop.hbase.nio">ByteBuff</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#cloneUncompressedBufferWithHeader()" class="member-name-link">cloneUncompressedBufferWithHeader</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Clones the header followed by the uncompressed data, even if using compression.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#encodedBlockSizeWritten()" class="member-name-link">encodedBlockSizeWritten</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the number of bytes written into the current block so far, or zero if not writing the
block at the moment.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>(package private) void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#ensureBlockReady()" class="member-name-link">ensureBlockReady</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Transitions the block writer from the "writing" state to the "block ready" state.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#expectState(org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer.State)" class="member-name-link">expectState</a><wbr>(<a href="HFileBlock.Writer.State.html" title="enum class in org.apache.hadoop.hbase.io.hfile">HFileBlock.Writer.State</a>&nbsp;expectedState)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#finishBlock()" class="member-name-link">finishBlock</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Finish up writing of the block.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>protected void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#finishBlockAndWriteHeaderAndData(java.io.DataOutputStream)" class="member-name-link">finishBlockAndWriteHeaderAndData</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/DataOutputStream.html" title="class or interface in java.io" class="external-link">DataOutputStream</a>&nbsp;out)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Writes the header and the compressed data of this block (or uncompressed data when not using
compression) into the given stream.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>(package private) <a href="HFileBlock.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileBlock</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getBlockForCaching(org.apache.hadoop.hbase.io.hfile.CacheConfig)" class="member-name-link">getBlockForCaching</a><wbr>(<a href="CacheConfig.html" title="class in org.apache.hadoop.hbase.io.hfile">CacheConfig</a>&nbsp;cacheConf)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Creates a new HFileBlock.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>(package private) <a href="../encoding/EncodingState.html" title="class in org.apache.hadoop.hbase.io.encoding">EncodingState</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getEncodingState()" class="member-name-link">getEncodingState</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>(package private) byte[]</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getHeaderAndDataForTest()" class="member-name-link">getHeaderAndDataForTest</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the header or the compressed data (or uncompressed data when not using compression)
as a byte array.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>(package private) int</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getOnDiskSizeWithHeader()" class="member-name-link">getOnDiskSizeWithHeader</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the on-disk size of the block.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>(package private) int</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getOnDiskSizeWithoutHeader()" class="member-name-link">getOnDiskSizeWithoutHeader</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the on-disk size of the data portion of the block.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getUncompressedSizeWithHeader()" class="member-name-link">getUncompressedSizeWithHeader</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">The uncompressed size of the block data, including header size.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>(package private) int</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getUncompressedSizeWithoutHeader()" class="member-name-link">getUncompressedSizeWithoutHeader</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">The uncompressed size of the block data.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>(package private) boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#isWriting()" class="member-name-link">isWriting</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns true if a block is being written</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#putHeader(byte%5B%5D,int,int,int,int)" class="member-name-link">putHeader</a><wbr>(byte[]&nbsp;dest,
int&nbsp;offset,
int&nbsp;onDiskSize,
int&nbsp;uncompressedSize,
int&nbsp;onDiskDataSize)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Put the header into the given byte array at the given offset.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#putHeader(org.apache.hadoop.hbase.io.ByteArrayOutputStream,int,int,int)" class="member-name-link">putHeader</a><wbr>(<a href="../ByteArrayOutputStream.html" title="class in org.apache.hadoop.hbase.io">ByteArrayOutputStream</a>&nbsp;dest,
int&nbsp;onDiskSize,
int&nbsp;uncompressedSize,
int&nbsp;onDiskDataSize)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#putHeader(org.apache.hadoop.hbase.nio.ByteBuff,int,int,int)" class="member-name-link">putHeader</a><wbr>(<a href="../../nio/ByteBuff.html" title="class in org.apache.hadoop.hbase.nio">ByteBuff</a>&nbsp;buff,
int&nbsp;onDiskSize,
int&nbsp;uncompressedSize,
int&nbsp;onDiskDataSize)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>(package private) void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#release()" class="member-name-link">release</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Releases resources used by this writer.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>(package private) <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/DataOutputStream.html" title="class or interface in java.io" class="external-link">DataOutputStream</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#startWriting(org.apache.hadoop.hbase.io.hfile.BlockType)" class="member-name-link">startWriting</a><wbr>(<a href="BlockType.html" title="enum class in org.apache.hadoop.hbase.io.hfile">BlockType</a>&nbsp;newBlockType)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Starts writing into the block.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>(package private) void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#write(org.apache.hadoop.hbase.ExtendedCell)" class="member-name-link">write</a><wbr>(<a href="../../ExtendedCell.html" title="interface in org.apache.hadoop.hbase">ExtendedCell</a>&nbsp;cell)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Writes the Cell to this block</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>(package private) void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#writeBlock(org.apache.hadoop.hbase.io.hfile.HFileBlock.BlockWritable,org.apache.hadoop.fs.FSDataOutputStream)" class="member-name-link">writeBlock</a><wbr>(<a href="HFileBlock.BlockWritable.html" title="interface in org.apache.hadoop.hbase.io.hfile">HFileBlock.BlockWritable</a>&nbsp;bw,
org.apache.hadoop.fs.FSDataOutputStream&nbsp;out)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Takes the given <a href="HFileBlock.BlockWritable.html" title="interface in org.apache.hadoop.hbase.io.hfile"><code>HFileBlock.BlockWritable</code></a> instance, creates a new block of its appropriate type,
writes the writable into this block, and flushes the block into the output stream.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>(package private) void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#writeHeaderAndData(org.apache.hadoop.fs.FSDataOutputStream)" class="member-name-link">writeHeaderAndData</a><wbr>(org.apache.hadoop.fs.FSDataOutputStream&nbsp;out)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Similar to <a href="#writeHeaderAndData(org.apache.hadoop.fs.FSDataOutputStream)"><code>writeHeaderAndData(FSDataOutputStream)</code></a>, but records the offset of this
block so that it can be referenced in the next block of the same type.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ FIELD DETAIL =========== -->
<li>
<section class="field-details" id="field-detail">
<h2>Field Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="maxSizeUnCompressed">
<h3>maxSizeUnCompressed</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-752">maxSizeUnCompressed</a></span></div>
</section>
</li>
<li>
<section class="detail" id="compressedSizePredicator">
<h3>compressedSizePredicator</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="BlockCompressedSizePredicator.html" title="interface in org.apache.hadoop.hbase.io.hfile">BlockCompressedSizePredicator</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-754">compressedSizePredicator</a></span></div>
</section>
</li>
<li>
<section class="detail" id="state">
<h3>state</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="HFileBlock.Writer.State.html" title="enum class in org.apache.hadoop.hbase.io.hfile">HFileBlock.Writer.State</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-757">state</a></span></div>
<div class="block">Writer state. Used to ensure the correct usage protocol.</div>
</section>
</li>
<li>
<section class="detail" id="dataBlockEncoder">
<h3>dataBlockEncoder</h3>
<div class="member-signature"><span class="modifiers">private final</span>&nbsp;<span class="return-type"><a href="HFileDataBlockEncoder.html" title="interface in org.apache.hadoop.hbase.io.hfile">HFileDataBlockEncoder</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-760">dataBlockEncoder</a></span></div>
<div class="block">Data block encoder used for data blocks</div>
</section>
</li>
<li>
<section class="detail" id="dataBlockEncodingCtx">
<h3>dataBlockEncodingCtx</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="../encoding/HFileBlockEncodingContext.html" title="interface in org.apache.hadoop.hbase.io.encoding">HFileBlockEncodingContext</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-762">dataBlockEncodingCtx</a></span></div>
</section>
</li>
<li>
<section class="detail" id="defaultBlockEncodingCtx">
<h3>defaultBlockEncodingCtx</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="../encoding/HFileBlockDefaultEncodingContext.html" title="class in org.apache.hadoop.hbase.io.encoding">HFileBlockDefaultEncodingContext</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-765">defaultBlockEncodingCtx</a></span></div>
<div class="block">block encoding context for non-data blocks</div>
</section>
</li>
<li>
<section class="detail" id="baosInMemory">
<h3>baosInMemory</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="../ByteArrayOutputStream.html" title="class in org.apache.hadoop.hbase.io">ByteArrayOutputStream</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-772">baosInMemory</a></span></div>
<div class="block">The stream we use to accumulate data into a block in an uncompressed format. We reset this
stream at the end of each block and reuse it. The header is written as the first
<a href="../../HConstants.html#HFILEBLOCK_HEADER_SIZE"><code>HConstants.HFILEBLOCK_HEADER_SIZE</code></a> bytes into this stream.</div>
</section>
</li>
<li>
<section class="detail" id="blockType">
<h3>blockType</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="BlockType.html" title="enum class in org.apache.hadoop.hbase.io.hfile">BlockType</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-778">blockType</a></span></div>
<div class="block">Current block type. Set in <a href="#startWriting(org.apache.hadoop.hbase.io.hfile.BlockType)"><code>startWriting(BlockType)</code></a>. Could be changed in
<a href="#finishBlock()"><code>finishBlock()</code></a> from <a href="BlockType.html#DATA"><code>BlockType.DATA</code></a> to <a href="BlockType.html#ENCODED_DATA"><code>BlockType.ENCODED_DATA</code></a>.</div>
</section>
</li>
<li>
<section class="detail" id="userDataStream">
<h3>userDataStream</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/DataOutputStream.html" title="class or interface in java.io" class="external-link">DataOutputStream</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-784">userDataStream</a></span></div>
<div class="block">A stream that we write uncompressed bytes to, which compresses them and writes them to
<a href="#baosInMemory"><code>baosInMemory</code></a>.</div>
</section>
</li>
<li>
<section class="detail" id="onDiskBlockBytesWithHeader">
<h3>onDiskBlockBytesWithHeader</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="../ByteArrayOutputStream.html" title="class in org.apache.hadoop.hbase.io">ByteArrayOutputStream</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-791">onDiskBlockBytesWithHeader</a></span></div>
<div class="block">Bytes to be written to the file system, including the header. Compressed if compression is
turned on. It also includes the checksum data that immediately follows the block data.
(header + data + checksums)</div>
</section>
</li>
<li>
<section class="detail" id="onDiskChecksum">
<h3>onDiskChecksum</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">byte[]</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-798">onDiskChecksum</a></span></div>
<div class="block">The size of the checksum data on disk. It is used only if data is not compressed. If data is
compressed, then the checksums are already part of onDiskBytesWithHeader. If data is
uncompressed, then this variable stores the checksum data for this block.</div>
</section>
</li>
<li>
<section class="detail" id="startOffset">
<h3>startOffset</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">long</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-804">startOffset</a></span></div>
<div class="block">Current block's start offset in the <a href="HFile.html" title="class in org.apache.hadoop.hbase.io.hfile"><code>HFile</code></a>. Set in
<a href="#writeHeaderAndData(org.apache.hadoop.fs.FSDataOutputStream)"><code>writeHeaderAndData(FSDataOutputStream)</code></a>.</div>
</section>
</li>
<li>
<section class="detail" id="prevOffsetByType">
<h3>prevOffsetByType</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">long[]</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-809">prevOffsetByType</a></span></div>
<div class="block">Offset of previous block by block type. Updated when the next block is started.</div>
</section>
</li>
<li>
<section class="detail" id="prevOffset">
<h3>prevOffset</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">long</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-812">prevOffset</a></span></div>
<div class="block">The offset of the previous block of the same type</div>
</section>
</li>
<li>
<section class="detail" id="fileContext">
<h3>fileContext</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="HFileContext.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileContext</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-814">fileContext</a></span></div>
<div class="block">Meta data that holds information about the hfileblock</div>
</section>
</li>
<li>
<section class="detail" id="allocator">
<h3>allocator</h3>
<div class="member-signature"><span class="modifiers">private final</span>&nbsp;<span class="return-type"><a href="../ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io">ByteBuffAllocator</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-816">allocator</a></span></div>
</section>
</li>
</ul>
</section>
</li>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li>
<section class="constructor-details" id="constructor-detail">
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;(org.apache.hadoop.conf.Configuration,org.apache.hadoop.hbase.io.hfile.HFileDataBlockEncoder,org.apache.hadoop.hbase.io.hfile.HFileContext)">
<h3>Writer</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-832">Writer</a></span><wbr><span class="parameters">(org.apache.hadoop.conf.Configuration&nbsp;conf,
<a href="HFileDataBlockEncoder.html" title="interface in org.apache.hadoop.hbase.io.hfile">HFileDataBlockEncoder</a>&nbsp;dataBlockEncoder,
<a href="HFileContext.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileContext</a>&nbsp;fileContext)</span></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>dataBlockEncoder</code> - data block encoding algorithm to use</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="&lt;init&gt;(org.apache.hadoop.conf.Configuration,org.apache.hadoop.hbase.io.hfile.HFileDataBlockEncoder,org.apache.hadoop.hbase.io.hfile.HFileContext,org.apache.hadoop.hbase.io.ByteBuffAllocator,int)">
<h3>Writer</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-837">Writer</a></span><wbr><span class="parameters">(org.apache.hadoop.conf.Configuration&nbsp;conf,
<a href="HFileDataBlockEncoder.html" title="interface in org.apache.hadoop.hbase.io.hfile">HFileDataBlockEncoder</a>&nbsp;dataBlockEncoder,
<a href="HFileContext.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileContext</a>&nbsp;fileContext,
<a href="../ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io">ByteBuffAllocator</a>&nbsp;allocator,
int&nbsp;maxSizeUnCompressed)</span></div>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="beforeShipped()">
<h3>beforeShipped</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-818">beforeShipped</a></span>()</div>
<div class="block"><span class="descfrm-type-label">Description copied from interface:&nbsp;<code><a href="../../regionserver/ShipperListener.html#beforeShipped()">ShipperListener</a></code></span></div>
<div class="block">The action that needs to be performed before <a href="../../regionserver/Shipper.html#shipped()"><code>Shipper.shipped()</code></a> is performed</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="../../regionserver/ShipperListener.html#beforeShipped()">beforeShipped</a></code>&nbsp;in interface&nbsp;<code><a href="../../regionserver/ShipperListener.html" title="interface in org.apache.hadoop.hbase.regionserver">ShipperListener</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getEncodingState()">
<h3>getEncodingState</h3>
<div class="member-signature"><span class="return-type"><a href="../encoding/EncodingState.html" title="class in org.apache.hadoop.hbase.io.encoding">EncodingState</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-825">getEncodingState</a></span>()</div>
</section>
</li>
<li>
<section class="detail" id="startWriting(org.apache.hadoop.hbase.io.hfile.BlockType)">
<h3>startWriting</h3>
<div class="member-signature"><span class="return-type"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/DataOutputStream.html" title="class or interface in java.io" class="external-link">DataOutputStream</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-871">startWriting</a></span><wbr><span class="parameters">(<a href="BlockType.html" title="enum class in org.apache.hadoop.hbase.io.hfile">BlockType</a>&nbsp;newBlockType)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Starts writing into the block. The previous block's data is discarded.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the stream the user can write their data into</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="write(org.apache.hadoop.hbase.ExtendedCell)">
<h3>write</h3>
<div class="member-signature"><span class="return-type">void</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-897">write</a></span><wbr><span class="parameters">(<a href="../../ExtendedCell.html" title="interface in org.apache.hadoop.hbase">ExtendedCell</a>&nbsp;cell)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Writes the Cell to this block</div>
<dl class="notes">
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="ensureBlockReady()">
<h3>ensureBlockReady</h3>
<div class="member-signature"><span class="return-type">void</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-906">ensureBlockReady</a></span>()
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Transitions the block writer from the "writing" state to the "block ready" state. Does
nothing if a block is already finished.</div>
<dl class="notes">
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="checkBoundariesWithPredicate()">
<h3>checkBoundariesWithPredicate</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-917">checkBoundariesWithPredicate</a></span>()</div>
</section>
</li>
<li>
<section class="detail" id="finishBlock()">
<h3>finishBlock</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-931">finishBlock</a></span>()
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Finish up writing of the block. Flushes the compressing stream (if using compression), fills
out the header, does any compression/encryption of bytes to flush out to disk, and manages
the cache on write content, if applicable. Sets block write state to "block ready".</div>
<dl class="notes">
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="putHeader(byte[],int,int,int,int)">
<h3>putHeader</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-993">putHeader</a></span><wbr><span class="parameters">(byte[]&nbsp;dest,
int&nbsp;offset,
int&nbsp;onDiskSize,
int&nbsp;uncompressedSize,
int&nbsp;onDiskDataSize)</span></div>
<div class="block">Put the header into the given byte array at the given offset.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>onDiskSize</code> - size of the block on disk header + data + checksum</dd>
<dd><code>uncompressedSize</code> - size of the block after decompression (but before optional data block
decoding) including header</dd>
<dd><code>onDiskDataSize</code> - size of the block on disk with header and data but not including the
checksums</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="putHeader(org.apache.hadoop.hbase.nio.ByteBuff,int,int,int)">
<h3>putHeader</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1004">putHeader</a></span><wbr><span class="parameters">(<a href="../../nio/ByteBuff.html" title="class in org.apache.hadoop.hbase.nio">ByteBuff</a>&nbsp;buff,
int&nbsp;onDiskSize,
int&nbsp;uncompressedSize,
int&nbsp;onDiskDataSize)</span></div>
</section>
</li>
<li>
<section class="detail" id="putHeader(org.apache.hadoop.hbase.io.ByteArrayOutputStream,int,int,int)">
<h3>putHeader</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1016">putHeader</a></span><wbr><span class="parameters">(<a href="../ByteArrayOutputStream.html" title="class in org.apache.hadoop.hbase.io">ByteArrayOutputStream</a>&nbsp;dest,
int&nbsp;onDiskSize,
int&nbsp;uncompressedSize,
int&nbsp;onDiskDataSize)</span></div>
</section>
</li>
<li>
<section class="detail" id="writeHeaderAndData(org.apache.hadoop.fs.FSDataOutputStream)">
<h3>writeHeaderAndData</h3>
<div class="member-signature"><span class="return-type">void</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1025">writeHeaderAndData</a></span><wbr><span class="parameters">(org.apache.hadoop.fs.FSDataOutputStream&nbsp;out)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Similar to <a href="#writeHeaderAndData(org.apache.hadoop.fs.FSDataOutputStream)"><code>writeHeaderAndData(FSDataOutputStream)</code></a>, but records the offset of this
block so that it can be referenced in the next block of the same type.</div>
<dl class="notes">
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="finishBlockAndWriteHeaderAndData(java.io.DataOutputStream)">
<h3>finishBlockAndWriteHeaderAndData</h3>
<div class="member-signature"><span class="modifiers">protected</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1042">finishBlockAndWriteHeaderAndData</a></span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/DataOutputStream.html" title="class or interface in java.io" class="external-link">DataOutputStream</a>&nbsp;out)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Writes the header and the compressed data of this block (or uncompressed data when not using
compression) into the given stream. Can be called in the "writing" state or in the "block
ready" state. If called in the "writing" state, transitions the writer to the "block ready"
state.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>out</code> - the output stream to write the</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getHeaderAndDataForTest()">
<h3>getHeaderAndDataForTest</h3>
<div class="member-signature"><span class="return-type">byte[]</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1057">getHeaderAndDataForTest</a></span>()
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Returns the header or the compressed data (or uncompressed data when not using compression)
as a byte array. Can be called in the "writing" state or in the "block ready" state. If
called in the "writing" state, transitions the writer to the "block ready" state. This
returns the header + data + checksums stored on disk.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>header and data as they would be stored on disk in a byte array</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="release()">
<h3>release</h3>
<div class="member-signature"><span class="return-type">void</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1072">release</a></span>()</div>
<div class="block">Releases resources used by this writer.</div>
</section>
</li>
<li>
<section class="detail" id="getOnDiskSizeWithoutHeader()">
<h3>getOnDiskSizeWithoutHeader</h3>
<div class="member-signature"><span class="return-type">int</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1089">getOnDiskSizeWithoutHeader</a></span>()</div>
<div class="block">Returns the on-disk size of the data portion of the block. This is the compressed size if
compression is enabled. Can only be called in the "block ready" state. Header is not
compressed, and its size is not included in the return value.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the on-disk size of the block, not including the header.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getOnDiskSizeWithHeader()">
<h3>getOnDiskSizeWithHeader</h3>
<div class="member-signature"><span class="return-type">int</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1100">getOnDiskSizeWithHeader</a></span>()</div>
<div class="block">Returns the on-disk size of the block. Can only be called in the "block ready" state.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the on-disk size of the block ready to be written, including the header size, the
data and the checksum data.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getUncompressedSizeWithoutHeader()">
<h3>getUncompressedSizeWithoutHeader</h3>
<div class="member-signature"><span class="return-type">int</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1108">getUncompressedSizeWithoutHeader</a></span>()</div>
<div class="block">The uncompressed size of the block data. Does not include header size.</div>
</section>
</li>
<li>
<section class="detail" id="getUncompressedSizeWithHeader()">
<h3>getUncompressedSizeWithHeader</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1116">getUncompressedSizeWithHeader</a></span>()</div>
<div class="block">The uncompressed size of the block data, including header size.</div>
</section>
</li>
<li>
<section class="detail" id="isWriting()">
<h3>isWriting</h3>
<div class="member-signature"><span class="return-type">boolean</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1122">isWriting</a></span>()</div>
<div class="block">Returns true if a block is being written</div>
</section>
</li>
<li>
<section class="detail" id="encodedBlockSizeWritten()">
<h3>encodedBlockSizeWritten</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1131">encodedBlockSizeWritten</a></span>()</div>
<div class="block">Returns the number of bytes written into the current block so far, or zero if not writing the
block at the moment. Note that this will return zero in the "block ready" state as well.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the number of bytes written</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="blockSizeWritten()">
<h3>blockSizeWritten</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1140">blockSizeWritten</a></span>()</div>
<div class="block">Returns the number of bytes written into the current block so far, or zero if not writing the
block at the moment. Note that this will return zero in the "block ready" state as well.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the number of bytes written</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="cloneUncompressedBufferWithHeader()">
<h3>cloneUncompressedBufferWithHeader</h3>
<div class="member-signature"><span class="return-type"><a href="../../nio/ByteBuff.html" title="class in org.apache.hadoop.hbase.nio">ByteBuff</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1151">cloneUncompressedBufferWithHeader</a></span>()</div>
<div class="block">Clones the header followed by the uncompressed data, even if using compression. This is
needed for storing uncompressed blocks in the block cache. Can be called in the "writing"
state or the "block ready" state. Returns only the header and data, does not include checksum
data.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>Returns an uncompressed block ByteBuff for caching on write</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="cloneOnDiskBufferWithHeader()">
<h3>cloneOnDiskBufferWithHeader</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="../../nio/ByteBuff.html" title="class in org.apache.hadoop.hbase.nio">ByteBuff</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1169">cloneOnDiskBufferWithHeader</a></span>()</div>
<div class="block">Clones the header followed by the on-disk (compressed/encoded/encrypted) data. This is needed
for storing packed blocks in the block cache. Returns only the header and data, Does not
include checksum data.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>Returns a copy of block bytes for caching on write</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="expectState(org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer.State)">
<h3>expectState</h3>
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1177">expectState</a></span><wbr><span class="parameters">(<a href="HFileBlock.Writer.State.html" title="enum class in org.apache.hadoop.hbase.io.hfile">HFileBlock.Writer.State</a>&nbsp;expectedState)</span></div>
</section>
</li>
<li>
<section class="detail" id="writeBlock(org.apache.hadoop.hbase.io.hfile.HFileBlock.BlockWritable,org.apache.hadoop.fs.FSDataOutputStream)">
<h3>writeBlock</h3>
<div class="member-signature"><span class="return-type">void</span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1191">writeBlock</a></span><wbr><span class="parameters">(<a href="HFileBlock.BlockWritable.html" title="interface in org.apache.hadoop.hbase.io.hfile">HFileBlock.BlockWritable</a>&nbsp;bw,
org.apache.hadoop.fs.FSDataOutputStream&nbsp;out)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Takes the given <a href="HFileBlock.BlockWritable.html" title="interface in org.apache.hadoop.hbase.io.hfile"><code>HFileBlock.BlockWritable</code></a> 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.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>bw</code> - the block-writable object to write as a block</dd>
<dd><code>out</code> - the file system output stream</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getBlockForCaching(org.apache.hadoop.hbase.io.hfile.CacheConfig)">
<h3>getBlockForCaching</h3>
<div class="member-signature"><span class="return-type"><a href="HFileBlock.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileBlock</a></span>&nbsp;<span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/HFileBlock.Writer.html#line-1207">getBlockForCaching</a></span><wbr><span class="parameters">(<a href="CacheConfig.html" title="class in org.apache.hadoop.hbase.io.hfile">CacheConfig</a>&nbsp;cacheConf)</span></div>
<div class="block">Creates a new HFileBlock. Checksums have already been validated, so the byte buffer passed
into the constructor of this newly created block does not have checksum data even though the
header minor version is MINOR_VERSION_WITH_CHECKSUM. This is indicated by setting a 0 value
in bytesPerChecksum. This method copies the on-disk or uncompressed data to build the
HFileBlock which is used only while writing blocks and caching.
<p>
TODO: Should there be an option where a cache can ask that hbase preserve block checksums for
checking after a block comes out of the cache? Otehrwise, cache is responsible for blocks
being wholesome (ECC memory or if file-backed, it does checksumming).</div>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &#169; 2007&#x2013;2020 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</div>
</div>
</body>
</html>