blob: 9d12a273641d5e7ebba2636080080edf7668c9f6 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.13) on Tue Feb 08 12:40:05 CST 2022 -->
<title>WriteFlusher (Eclipse Jetty API Doc - v10.0.8)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2022-02-08">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../jquery/jquery-3.5.1.js"></script>
<script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="WriteFlusher (Eclipse Jetty API Doc - v10.0.8)";
}
}
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":6,"i7":10,"i8":10,"i9":10,"i10":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/WriteFlusher.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">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">org.eclipse.jetty.io</a></div>
<h2 title="Class WriteFlusher" class="title">Class WriteFlusher</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.eclipse.jetty.io.WriteFlusher</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<pre>public abstract class <span class="typeNameLabel">WriteFlusher</span>
extends java.lang.Object</pre>
<div class="block">A Utility class to help implement <a href="EndPoint.html#write(org.eclipse.jetty.util.Callback,java.nio.ByteBuffer...)"><code>EndPoint.write(Callback, ByteBuffer...)</code></a> by calling
<a href="EndPoint.html#flush(java.nio.ByteBuffer...)"><code>EndPoint.flush(ByteBuffer...)</code></a> until all content is written.
The abstract method <a href="#onIncompleteFlush()"><code>onIncompleteFlush()</code></a> is called when not all content has been written after a call to
flush and should organize for the <a href="#completeWrite()"><code>completeWrite()</code></a> method to be called when a subsequent call to flush
should be able to make more progress.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static interface&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="WriteFlusher.Listener.html" title="interface in org.eclipse.jetty.io">WriteFlusher.Listener</a></span></code></th>
<td class="colLast">
<div class="block">A listener of <a href="WriteFlusher.html" title="class in org.eclipse.jetty.io"><code>WriteFlusher</code></a> events.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier</th>
<th class="colSecond" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected </code></td>
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(org.eclipse.jetty.io.EndPoint)">WriteFlusher</a></span>&#8203;(<a href="EndPoint.html" title="interface in org.eclipse.jetty.io">EndPoint</a>&nbsp;endPoint)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#completeWrite()">completeWrite</a></span>()</code></th>
<td class="colLast">
<div class="block">Complete a write that has not completed and that called <a href="#onIncompleteFlush()"><code>onIncompleteFlush()</code></a> to request a call to this
method when a call to <a href="EndPoint.html#flush(java.nio.ByteBuffer...)"><code>EndPoint.flush(ByteBuffer...)</code></a> is likely to be able to progress.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>protected java.nio.ByteBuffer[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#flush(java.net.SocketAddress,java.nio.ByteBuffer%5B%5D)">flush</a></span>&#8203;(java.net.SocketAddress&nbsp;address,
java.nio.ByteBuffer[]&nbsp;buffers)</code></th>
<td class="colLast">
<div class="block">Flushes the buffers iteratively until no progress is made.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="../util/thread/Invocable.InvocationType.html" title="enum in org.eclipse.jetty.util.thread">Invocable.InvocationType</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getCallbackInvocationType()">getCallbackInvocationType</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isPending()">isPending</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#onClose()">onClose</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#onFail(java.lang.Throwable)">onFail</a></span>&#8203;(java.lang.Throwable&nbsp;cause)</code></th>
<td class="colLast">
<div class="block">Notify the flusher of a failure</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>protected abstract void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#onIncompleteFlush()">onIncompleteFlush</a></span>()</code></th>
<td class="colLast">
<div class="block">Abstract call to be implemented by specific WriteFlushers.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toStateString()">toStateString</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toString()">toString</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#write(org.eclipse.jetty.util.Callback,java.net.SocketAddress,java.nio.ByteBuffer...)">write</a></span>&#8203;(<a href="../util/Callback.html" title="interface in org.eclipse.jetty.util">Callback</a>&nbsp;callback,
java.net.SocketAddress&nbsp;address,
java.nio.ByteBuffer...&nbsp;buffers)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#write(org.eclipse.jetty.util.Callback,java.nio.ByteBuffer...)">write</a></span>&#8203;(<a href="../util/Callback.html" title="interface in org.eclipse.jetty.util">Callback</a>&nbsp;callback,
java.nio.ByteBuffer...&nbsp;buffers)</code></th>
<td class="colLast">
<div class="block">Tries to switch state to WRITING.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a id="&lt;init&gt;(org.eclipse.jetty.io.EndPoint)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>WriteFlusher</h4>
<pre>protected&nbsp;WriteFlusher&#8203;(<a href="EndPoint.html" title="interface in org.eclipse.jetty.io">EndPoint</a>&nbsp;endPoint)</pre>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="getCallbackInvocationType()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCallbackInvocationType</h4>
<pre class="methodSignature">public&nbsp;<a href="../util/thread/Invocable.InvocationType.html" title="enum in org.eclipse.jetty.util.thread">Invocable.InvocationType</a>&nbsp;getCallbackInvocationType()</pre>
</li>
</ul>
<a id="onIncompleteFlush()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onIncompleteFlush</h4>
<pre class="methodSignature">protected abstract&nbsp;void&nbsp;onIncompleteFlush()</pre>
<div class="block">Abstract call to be implemented by specific WriteFlushers. It should schedule a call to <a href="#completeWrite()"><code>completeWrite()</code></a>
or <a href="#onFail(java.lang.Throwable)"><code>onFail(Throwable)</code></a> when appropriate.</div>
</li>
</ul>
<a id="write(org.eclipse.jetty.util.Callback,java.nio.ByteBuffer...)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>write</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;write&#8203;(<a href="../util/Callback.html" title="interface in org.eclipse.jetty.util">Callback</a>&nbsp;callback,
java.nio.ByteBuffer...&nbsp;buffers)
throws java.nio.channels.WritePendingException</pre>
<div class="block">Tries to switch state to WRITING. If successful it writes the given buffers to the EndPoint. If state transition
fails it will fail the callback and leave the WriteFlusher in a terminal FAILED state.
If not all buffers can be written in one go it creates a new <code>PendingState</code> object to preserve the state
and then calls <a href="#onIncompleteFlush()"><code>onIncompleteFlush()</code></a>. The remaining buffers will be written in <a href="#completeWrite()"><code>completeWrite()</code></a>.
If all buffers have been written it calls callback.complete().</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>callback</code> - the callback to call on either failed or complete</dd>
<dd><code>buffers</code> - the buffers to flush to the endpoint</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.nio.channels.WritePendingException</code> - if unable to write due to prior pending write</dd>
</dl>
</li>
</ul>
<a id="write(org.eclipse.jetty.util.Callback,java.net.SocketAddress,java.nio.ByteBuffer...)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>write</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;write&#8203;(<a href="../util/Callback.html" title="interface in org.eclipse.jetty.util">Callback</a>&nbsp;callback,
java.net.SocketAddress&nbsp;address,
java.nio.ByteBuffer...&nbsp;buffers)
throws java.nio.channels.WritePendingException</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.nio.channels.WritePendingException</code></dd>
</dl>
</li>
</ul>
<a id="completeWrite()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>completeWrite</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;completeWrite()</pre>
<div class="block">Complete a write that has not completed and that called <a href="#onIncompleteFlush()"><code>onIncompleteFlush()</code></a> to request a call to this
method when a call to <a href="EndPoint.html#flush(java.nio.ByteBuffer...)"><code>EndPoint.flush(ByteBuffer...)</code></a> is likely to be able to progress.
It tries to switch from PENDING to COMPLETING. If state transition fails, then it does nothing as the callback
should have been already failed. That's because the only way to switch from PENDING outside this method is
<a href="#onFail(java.lang.Throwable)"><code>onFail(Throwable)</code></a> or <a href="#onClose()"><code>onClose()</code></a></div>
</li>
</ul>
<a id="flush(java.net.SocketAddress,java.nio.ByteBuffer[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>flush</h4>
<pre class="methodSignature">protected&nbsp;java.nio.ByteBuffer[]&nbsp;flush&#8203;(java.net.SocketAddress&nbsp;address,
java.nio.ByteBuffer[]&nbsp;buffers)
throws java.io.IOException</pre>
<div class="block">Flushes the buffers iteratively until no progress is made.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffers</code> - The buffers to flush</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The unflushed buffers, or null if all flushed</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code> - if unable to flush</dd>
</dl>
</li>
</ul>
<a id="onFail(java.lang.Throwable)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onFail</h4>
<pre class="methodSignature">public&nbsp;boolean&nbsp;onFail&#8203;(java.lang.Throwable&nbsp;cause)</pre>
<div class="block">Notify the flusher of a failure</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cause</code> - The cause of the failure</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the flusher passed the failure to a <a href="../util/Callback.html" title="interface in org.eclipse.jetty.util"><code>Callback</code></a> instance</dd>
</dl>
</li>
</ul>
<a id="onClose()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onClose</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;onClose()</pre>
</li>
</ul>
<a id="isPending()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isPending</h4>
<pre class="methodSignature">public&nbsp;boolean&nbsp;isPending()</pre>
</li>
</ul>
<a id="toStateString()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toStateString</h4>
<pre class="methodSignature">public&nbsp;java.lang.String&nbsp;toStateString()</pre>
</li>
</ul>
<a id="toString()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>toString</h4>
<pre class="methodSignature">public&nbsp;java.lang.String&nbsp;toString()</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/WriteFlusher.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">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Copyright &#169; 1995&#x2013;2022 <a href="https://webtide.com">Webtide</a>. All rights reserved.</small></p>
</footer>
</body>
</html>