blob: 3377164c9a83cb8b4e0a9e83e66304be09b55971 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.9) on Wed Nov 04 12:15:18 CST 2020 -->
<title>BufferUtil (Jetty :: Project 9.4.34.v20201102 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2020-11-04">
<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="BufferUtil (Jetty :: Project 9.4.34.v20201102 API)";
}
}
catch(err) {
}
//-->
var data = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":41,"i11":9,"i12":9,"i13":9,"i14":9,"i15":9,"i16":9,"i17":41,"i18":9,"i19":9,"i20":9,"i21":9,"i22":9,"i23":9,"i24":9,"i25":9,"i26":9,"i27":9,"i28":9,"i29":9,"i30":9,"i31":9,"i32":9,"i33":9,"i34":9,"i35":9,"i36":9,"i37":9,"i38":9,"i39":9,"i40":9,"i41":9,"i42":9,"i43":9,"i44":9,"i45":9,"i46":9,"i47":9,"i48":9,"i49":9,"i50":9,"i51":9,"i52":9,"i53":9,"i54":9,"i55":9,"i56":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../";
var useModuleDirectories = false;
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/BufferUtil.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>Nested&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="subNavList">
<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>
<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.util</a></div>
<h2 title="Class BufferUtil" class="title">Class BufferUtil</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.eclipse.jetty.util.BufferUtil</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<pre>public class <span class="typeNameLabel">BufferUtil</span>
extends java.lang.Object</pre>
<div class="block">Buffer utility methods.
<p>The standard JVM <code>ByteBuffer</code> can exist in two modes: In fill mode the valid
data is between 0 and pos; In flush mode the valid data is between the pos and the limit.
The various ByteBuffer methods assume a mode and some of them will switch or enforce a mode:
Allocate and clear set fill mode; flip and compact switch modes; read and write assume fill
and flush modes. This duality can result in confusing code such as:
</p>
<pre>
buffer.clear();
channel.write(buffer);
</pre>
<p>
Which looks as if it should write no data, but in fact writes the buffer worth of garbage.
</p>
<p>
The BufferUtil class provides a set of utilities that operate on the convention that ByteBuffers
will always be left, passed in an API or returned from a method in the flush mode - ie with
valid data between the pos and limit. This convention is adopted so as to avoid confusion as to
what state a buffer is in and to avoid excessive copying of data that can result with the usage
of compress.</p>
<p>
Thus this class provides alternate implementations of <a href="#allocate(int)"><code>allocate(int)</code></a>,
<a href="#allocateDirect(int)"><code>allocateDirect(int)</code></a> and <a href="#clear(java.nio.ByteBuffer)"><code>clear(ByteBuffer)</code></a> that leave the buffer
in flush mode. Thus the following tests will pass:
</p>
<pre>
ByteBuffer buffer = BufferUtil.allocate(1024);
assert(buffer.remaining()==0);
BufferUtil.clear(buffer);
assert(buffer.remaining()==0);
</pre>
<p>If the BufferUtil methods <a href="#fill(java.nio.ByteBuffer,byte%5B%5D,int,int)"><code>fill(ByteBuffer, byte[], int, int)</code></a>,
<a href="#append(java.nio.ByteBuffer,byte%5B%5D,int,int)"><code>append(ByteBuffer, byte[], int, int)</code></a> or <a href="#put(java.nio.ByteBuffer,java.nio.ByteBuffer)"><code>put(ByteBuffer, ByteBuffer)</code></a> are used,
then the caller does not need to explicitly switch the buffer to fill mode.
If the caller wishes to use other ByteBuffer bases libraries to fill a buffer,
then they can use explicit calls of #flipToFill(ByteBuffer) and #flipToFlush(ByteBuffer, int)
to change modes. Note because this convention attempts to avoid the copies of compact, the position
is not set to zero on each fill cycle and so its value must be remembered:
</p>
<pre>
int pos = BufferUtil.flipToFill(buffer);
try
{
buffer.put(data);
}
finally
{
flipToFlush(buffer, pos);
}
</pre>
<p>
The flipToFill method will effectively clear the buffer if it is empty and will compact the buffer if there is no space.
</p></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Field</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.nio.ByteBuffer</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#EMPTY_BUFFER">EMPTY_BUFFER</a></span></code></th>
<td class="colLast">&nbsp;</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">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">BufferUtil</a></span>()</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="t1" class="tableTab"><span><a href="javascript:show(1);">Static 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><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated 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>static java.nio.ByteBuffer</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#allocate(int)">allocate</a></span>&#8203;(int&nbsp;capacity)</code></th>
<td class="colLast">
<div class="block">Allocate ByteBuffer in flush mode.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static java.nio.ByteBuffer</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#allocateDirect(int)">allocateDirect</a></span>&#8203;(int&nbsp;capacity)</code></th>
<td class="colLast">
<div class="block">Allocate ByteBuffer in flush mode.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#append(java.nio.ByteBuffer,byte)">append</a></span>&#8203;(java.nio.ByteBuffer&nbsp;to,
byte&nbsp;b)</code></th>
<td class="colLast">
<div class="block">Appends a byte to a buffer</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#append(java.nio.ByteBuffer,byte%5B%5D,int,int)">append</a></span>&#8203;(java.nio.ByteBuffer&nbsp;to,
byte[]&nbsp;b,
int&nbsp;off,
int&nbsp;len)</code></th>
<td class="colLast">
<div class="block">Append bytes to a buffer.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#append(java.nio.ByteBuffer,java.nio.ByteBuffer)">append</a></span>&#8203;(java.nio.ByteBuffer&nbsp;to,
java.nio.ByteBuffer&nbsp;b)</code></th>
<td class="colLast">
<div class="block">Appends a buffer to a buffer</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#clear(java.nio.ByteBuffer)">clear</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Clear the buffer to be empty in flush mode.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#clearToFill(java.nio.ByteBuffer)">clearToFill</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Clear the buffer to be empty in fill mode.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>static boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#compact(java.nio.ByteBuffer)">compact</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Compact the buffer</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>static java.nio.ByteBuffer</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ensureCapacity(java.nio.ByteBuffer,int)">ensureCapacity</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer,
int&nbsp;capacity)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#fill(java.nio.ByteBuffer,byte%5B%5D,int,int)">fill</a></span>&#8203;(java.nio.ByteBuffer&nbsp;to,
byte[]&nbsp;b,
int&nbsp;off,
int&nbsp;len)</code></th>
<td class="colLast">
<div class="block">Like append, but does not throw <code>BufferOverflowException</code></div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#flipPutFlip(java.nio.ByteBuffer,java.nio.ByteBuffer)">flipPutFlip</a></span>&#8203;(java.nio.ByteBuffer&nbsp;from,
java.nio.ByteBuffer&nbsp;to)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span>
<div class="deprecationComment">use <a href="#append(java.nio.ByteBuffer,java.nio.ByteBuffer)"><code>append(ByteBuffer, ByteBuffer)</code></a></div>
</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#flipToFill(java.nio.ByteBuffer)">flipToFill</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Flip the buffer to fill mode.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#flipToFlush(java.nio.ByteBuffer,int)">flipToFlush</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer,
int&nbsp;position)</code></th>
<td class="colLast">
<div class="block">Flip the buffer to Flush mode.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>static boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#hasContent(java.nio.ByteBuffer)">hasContent</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buf)</code></th>
<td class="colLast">
<div class="block">Check for a non null and non empty buffer.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>static boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isEmpty(java.nio.ByteBuffer)">isEmpty</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buf)</code></th>
<td class="colLast">
<div class="block">Check for an empty or null buffer.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>static boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isEmpty(java.nio.ByteBuffer%5B%5D)">isEmpty</a></span>&#8203;(java.nio.ByteBuffer[]&nbsp;buf)</code></th>
<td class="colLast">
<div class="block">Check for an empty or null buffers.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>static boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isFull(java.nio.ByteBuffer)">isFull</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buf)</code></th>
<td class="colLast">
<div class="block">Check for a non null and full buffer.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>static boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isMappedBuffer(java.nio.ByteBuffer)">isMappedBuffer</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block"><span class="deprecatedLabel">Deprecated.</span>
<div class="deprecationComment">don't use - there is no way to reliably tell if a ByteBuffer is mapped.</div>
</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>static boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isPrefix(java.nio.ByteBuffer,java.nio.ByteBuffer)">isPrefix</a></span>&#8203;(java.nio.ByteBuffer&nbsp;prefix,
java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>static boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isTheEmptyBuffer(java.nio.ByteBuffer)">isTheEmptyBuffer</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buf)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#length(java.nio.ByteBuffer)">length</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Get remaining from null checked buffer</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#put(java.nio.ByteBuffer,java.nio.ByteBuffer)">put</a></span>&#8203;(java.nio.ByteBuffer&nbsp;from,
java.nio.ByteBuffer&nbsp;to)</code></th>
<td class="colLast">
<div class="block">Put data from one buffer into another, avoiding over/under flows</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#putCRLF(java.nio.ByteBuffer)">putCRLF</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i23" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#putDecInt(java.nio.ByteBuffer,int)">putDecInt</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer,
int&nbsp;n)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i24" class="altColor">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#putDecLong(java.nio.ByteBuffer,long)">putDecLong</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer,
long&nbsp;n)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i25" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#putHexInt(java.nio.ByteBuffer,int)">putHexInt</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer,
int&nbsp;n)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i26" class="altColor">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#putIntLittleEndian(java.nio.ByteBuffer,int)">putIntLittleEndian</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer,
int&nbsp;value)</code></th>
<td class="colLast">
<div class="block">Put an integer little endian</div>
</td>
</tr>
<tr id="i27" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#readFrom(java.io.File,java.nio.ByteBuffer)">readFrom</a></span>&#8203;(java.io.File&nbsp;file,
java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i28" class="altColor">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#readFrom(java.io.InputStream,int,java.nio.ByteBuffer)">readFrom</a></span>&#8203;(java.io.InputStream&nbsp;is,
int&nbsp;needed,
java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i29" class="rowColor">
<td class="colFirst"><code>static long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#remaining(java.nio.ByteBuffer...)">remaining</a></span>&#8203;(java.nio.ByteBuffer...&nbsp;buf)</code></th>
<td class="colLast">
<div class="block">Get the remaining bytes in 0 or more buffers.</div>
</td>
</tr>
<tr id="i30" class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#space(java.nio.ByteBuffer)">space</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Get the space from the limit to the capacity</div>
</td>
</tr>
<tr id="i31" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#takeInt(java.nio.ByteBuffer)">takeInt</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Convert buffer to an integer.</div>
</td>
</tr>
<tr id="i32" class="altColor">
<td class="colFirst"><code>static byte[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toArray(java.nio.ByteBuffer)">toArray</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Convert a ByteBuffer to a byte array.</div>
</td>
</tr>
<tr id="i33" class="rowColor">
<td class="colFirst"><code>static java.nio.ByteBuffer</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toBuffer(byte%5B%5D)">toBuffer</a></span>&#8203;(byte[]&nbsp;array)</code></th>
<td class="colLast">
<div class="block">Create a new ByteBuffer using provided byte array.</div>
</td>
</tr>
<tr id="i34" class="altColor">
<td class="colFirst"><code>static java.nio.ByteBuffer</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toBuffer(byte%5B%5D,int,int)">toBuffer</a></span>&#8203;(byte[]&nbsp;array,
int&nbsp;offset,
int&nbsp;length)</code></th>
<td class="colLast">
<div class="block">Create a new ByteBuffer using the provided byte array.</div>
</td>
</tr>
<tr id="i35" class="rowColor">
<td class="colFirst"><code>static java.nio.ByteBuffer</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toBuffer(int)">toBuffer</a></span>&#8203;(int&nbsp;value)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i36" class="altColor">
<td class="colFirst"><code>static java.nio.ByteBuffer</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toBuffer(long)">toBuffer</a></span>&#8203;(long&nbsp;value)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i37" class="rowColor">
<td class="colFirst"><code>static java.nio.ByteBuffer</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toBuffer(java.lang.String)">toBuffer</a></span>&#8203;(java.lang.String&nbsp;s)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i38" class="altColor">
<td class="colFirst"><code>static java.nio.ByteBuffer</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toBuffer(java.lang.String,java.nio.charset.Charset)">toBuffer</a></span>&#8203;(java.lang.String&nbsp;s,
java.nio.charset.Charset&nbsp;charset)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i39" class="rowColor">
<td class="colFirst"><code>static java.nio.ByteBuffer</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toBuffer(org.eclipse.jetty.util.resource.Resource,boolean)">toBuffer</a></span>&#8203;(<a href="resource/Resource.html" title="class in org.eclipse.jetty.util.resource">Resource</a>&nbsp;resource,
boolean&nbsp;direct)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i40" class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toDetailString(java.nio.ByteBuffer)">toDetailString</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Convert Buffer to a detail debug string of pointers and content</div>
</td>
</tr>
<tr id="i41" class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toDetailString(java.nio.ByteBuffer%5B%5D)">toDetailString</a></span>&#8203;(java.nio.ByteBuffer[]&nbsp;buffer)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i42" class="altColor">
<td class="colFirst"><code>static java.nio.ByteBuffer</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toDirectBuffer(java.lang.String)">toDirectBuffer</a></span>&#8203;(java.lang.String&nbsp;s)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i43" class="rowColor">
<td class="colFirst"><code>static java.nio.ByteBuffer</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toDirectBuffer(java.lang.String,java.nio.charset.Charset)">toDirectBuffer</a></span>&#8203;(java.lang.String&nbsp;s,
java.nio.charset.Charset&nbsp;charset)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i44" class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toHexString(java.nio.ByteBuffer)">toHexString</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Convert buffer to a Hex String.</div>
</td>
</tr>
<tr id="i45" class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toHexSummary(java.nio.ByteBuffer)">toHexSummary</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Convert buffer to a Hex Summary String.</div>
</td>
</tr>
<tr id="i46" class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toIDString(java.nio.ByteBuffer)">toIDString</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Convert Buffer to string ID independent of content</div>
</td>
</tr>
<tr id="i47" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toInt(java.nio.ByteBuffer)">toInt</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Convert buffer to an integer.</div>
</td>
</tr>
<tr id="i48" class="altColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toInt(java.nio.ByteBuffer,int,int)">toInt</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer,
int&nbsp;position,
int&nbsp;length)</code></th>
<td class="colLast">
<div class="block">Convert buffer to an integer.</div>
</td>
</tr>
<tr id="i49" class="rowColor">
<td class="colFirst"><code>static long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toLong(java.nio.ByteBuffer)">toLong</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Convert buffer to an long.</div>
</td>
</tr>
<tr id="i50" class="altColor">
<td class="colFirst"><code>static java.nio.ByteBuffer</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toMappedBuffer(java.io.File)">toMappedBuffer</a></span>&#8203;(java.io.File&nbsp;file)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i51" class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toString(java.nio.ByteBuffer)">toString</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Convert the buffer to an ISO-8859-1 String</div>
</td>
</tr>
<tr id="i52" class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toString(java.nio.ByteBuffer,int,int,java.nio.charset.Charset)">toString</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer,
int&nbsp;position,
int&nbsp;length,
java.nio.charset.Charset&nbsp;charset)</code></th>
<td class="colLast">
<div class="block">Convert a partial buffer to a String.</div>
</td>
</tr>
<tr id="i53" class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toString(java.nio.ByteBuffer,java.nio.charset.Charset)">toString</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer,
java.nio.charset.Charset&nbsp;charset)</code></th>
<td class="colLast">
<div class="block">Convert the buffer to an ISO-8859-1 String</div>
</td>
</tr>
<tr id="i54" class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toSummaryString(java.nio.ByteBuffer)">toSummaryString</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i55" class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toUTF8String(java.nio.ByteBuffer)">toUTF8String</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Convert the buffer to an UTF-8 String</div>
</td>
</tr>
<tr id="i56" class="altColor">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeTo(java.nio.ByteBuffer,java.io.OutputStream)">writeTo</a></span>&#8203;(java.nio.ByteBuffer&nbsp;buffer,
java.io.OutputStream&nbsp;out)</code></th>
<td class="colLast">&nbsp;</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, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a id="EMPTY_BUFFER">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>EMPTY_BUFFER</h4>
<pre>public static final&nbsp;java.nio.ByteBuffer EMPTY_BUFFER</pre>
</li>
</ul>
</li>
</ul>
</section>
<!-- ========= 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;()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>BufferUtil</h4>
<pre>public&nbsp;BufferUtil()</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="allocate(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>allocate</h4>
<pre class="methodSignature">public static&nbsp;java.nio.ByteBuffer&nbsp;allocate&#8203;(int&nbsp;capacity)</pre>
<div class="block">Allocate ByteBuffer in flush mode.
The position and limit will both be zero, indicating that the buffer is
empty and must be flipped before any data is put to it.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>capacity</code> - capacity of the allocated ByteBuffer</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Buffer</dd>
</dl>
</li>
</ul>
<a id="allocateDirect(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>allocateDirect</h4>
<pre class="methodSignature">public static&nbsp;java.nio.ByteBuffer&nbsp;allocateDirect&#8203;(int&nbsp;capacity)</pre>
<div class="block">Allocate ByteBuffer in flush mode.
The position and limit will both be zero, indicating that the buffer is
empty and in flush mode.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>capacity</code> - capacity of the allocated ByteBuffer</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Buffer</dd>
</dl>
</li>
</ul>
<a id="clear(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clear</h4>
<pre class="methodSignature">public static&nbsp;void&nbsp;clear&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Clear the buffer to be empty in flush mode.
The position and limit are set to 0;</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - The buffer to clear.</dd>
</dl>
</li>
</ul>
<a id="clearToFill(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clearToFill</h4>
<pre class="methodSignature">public static&nbsp;void&nbsp;clearToFill&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Clear the buffer to be empty in fill mode.
The position is set to 0 and the limit is set to the capacity.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - The buffer to clear.</dd>
</dl>
</li>
</ul>
<a id="flipToFill(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>flipToFill</h4>
<pre class="methodSignature">public static&nbsp;int&nbsp;flipToFill&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Flip the buffer to fill mode.
The position is set to the first unused position in the buffer
(the old limit) and the limit is set to the capacity.
If the buffer is empty, then this call is effectively <a href="#clearToFill(java.nio.ByteBuffer)"><code>clearToFill(ByteBuffer)</code></a>.
If there is no unused space to fill, a <code>ByteBuffer.compact()</code> is done to attempt
to create space.
<p>
This method is used as a replacement to <code>ByteBuffer.compact()</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - The buffer to flip</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The position of the valid data before the flipped position. This value should be
passed to a subsequent call to <a href="#flipToFlush(java.nio.ByteBuffer,int)"><code>flipToFlush(ByteBuffer, int)</code></a></dd>
</dl>
</li>
</ul>
<a id="flipToFlush(java.nio.ByteBuffer,int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>flipToFlush</h4>
<pre class="methodSignature">public static&nbsp;void&nbsp;flipToFlush&#8203;(java.nio.ByteBuffer&nbsp;buffer,
int&nbsp;position)</pre>
<div class="block">Flip the buffer to Flush mode.
The limit is set to the first unused byte(the old position) and
the position is set to the passed position.
<p>
This method is used as a replacement of <code>Buffer.flip()</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - the buffer to be flipped</dd>
<dd><code>position</code> - The position of valid data to flip to. This should
be the return value of the previous call to <a href="#flipToFill(java.nio.ByteBuffer)"><code>flipToFill(ByteBuffer)</code></a></dd>
</dl>
</li>
</ul>
<a id="putIntLittleEndian(java.nio.ByteBuffer,int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putIntLittleEndian</h4>
<pre class="methodSignature">public static&nbsp;void&nbsp;putIntLittleEndian&#8203;(java.nio.ByteBuffer&nbsp;buffer,
int&nbsp;value)</pre>
<div class="block">Put an integer little endian</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - The buffer to put to</dd>
<dd><code>value</code> - The value to put.</dd>
</dl>
</li>
</ul>
<a id="toArray(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toArray</h4>
<pre class="methodSignature">public static&nbsp;byte[]&nbsp;toArray&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Convert a ByteBuffer to a byte array.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - The buffer to convert in flush mode. The buffer is not altered.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>An array of bytes duplicated from the buffer.</dd>
</dl>
</li>
</ul>
<a id="isTheEmptyBuffer(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isTheEmptyBuffer</h4>
<pre class="methodSignature">public static&nbsp;boolean&nbsp;isTheEmptyBuffer&#8203;(java.nio.ByteBuffer&nbsp;buf)</pre>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buf</code> - the buffer to check</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if buf is equal to EMPTY_BUFFER</dd>
</dl>
</li>
</ul>
<a id="isEmpty(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isEmpty</h4>
<pre class="methodSignature">public static&nbsp;boolean&nbsp;isEmpty&#8203;(java.nio.ByteBuffer&nbsp;buf)</pre>
<div class="block">Check for an empty or null buffer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buf</code> - the buffer to check</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the buffer is null or empty.</dd>
</dl>
</li>
</ul>
<a id="isEmpty(java.nio.ByteBuffer[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isEmpty</h4>
<pre class="methodSignature">public static&nbsp;boolean&nbsp;isEmpty&#8203;(java.nio.ByteBuffer[]&nbsp;buf)</pre>
<div class="block">Check for an empty or null buffers.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buf</code> - the buffer to check</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the buffer is null or empty.</dd>
</dl>
</li>
</ul>
<a id="remaining(java.nio.ByteBuffer...)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>remaining</h4>
<pre class="methodSignature">public static&nbsp;long&nbsp;remaining&#8203;(java.nio.ByteBuffer...&nbsp;buf)</pre>
<div class="block">Get the remaining bytes in 0 or more buffers.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buf</code> - the buffers to check</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>number of bytes remaining in all buffers.</dd>
</dl>
</li>
</ul>
<a id="hasContent(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hasContent</h4>
<pre class="methodSignature">public static&nbsp;boolean&nbsp;hasContent&#8203;(java.nio.ByteBuffer&nbsp;buf)</pre>
<div class="block">Check for a non null and non empty buffer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buf</code> - the buffer to check</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the buffer is not null and not empty.</dd>
</dl>
</li>
</ul>
<a id="isFull(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isFull</h4>
<pre class="methodSignature">public static&nbsp;boolean&nbsp;isFull&#8203;(java.nio.ByteBuffer&nbsp;buf)</pre>
<div class="block">Check for a non null and full buffer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buf</code> - the buffer to check</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the buffer is not null and the limit equals the capacity.</dd>
</dl>
</li>
</ul>
<a id="length(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>length</h4>
<pre class="methodSignature">public static&nbsp;int&nbsp;length&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Get remaining from null checked buffer</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - The buffer to get the remaining from, in flush mode.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>0 if the buffer is null, else the bytes remaining in the buffer.</dd>
</dl>
</li>
</ul>
<a id="space(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>space</h4>
<pre class="methodSignature">public static&nbsp;int&nbsp;space&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Get the space from the limit to the capacity</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - the buffer to get the space from</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>space</dd>
</dl>
</li>
</ul>
<a id="compact(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>compact</h4>
<pre class="methodSignature">public static&nbsp;boolean&nbsp;compact&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Compact the buffer</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - the buffer to compact</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the compact made a full buffer have space</dd>
</dl>
</li>
</ul>
<a id="put(java.nio.ByteBuffer,java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>put</h4>
<pre class="methodSignature">public static&nbsp;int&nbsp;put&#8203;(java.nio.ByteBuffer&nbsp;from,
java.nio.ByteBuffer&nbsp;to)</pre>
<div class="block">Put data from one buffer into another, avoiding over/under flows</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>from</code> - Buffer to take bytes from in flush mode</dd>
<dd><code>to</code> - Buffer to put bytes to in fill mode.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>number of bytes moved</dd>
</dl>
</li>
</ul>
<a id="flipPutFlip(java.nio.ByteBuffer,java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>flipPutFlip</h4>
<pre class="methodSignature">public static&nbsp;int&nbsp;flipPutFlip&#8203;(java.nio.ByteBuffer&nbsp;from,
java.nio.ByteBuffer&nbsp;to)</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span>
<div class="deprecationComment">use <a href="#append(java.nio.ByteBuffer,java.nio.ByteBuffer)"><code>append(ByteBuffer, ByteBuffer)</code></a></div>
</div>
<div class="block">Put data from one buffer into another, avoiding over/under flows</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>from</code> - Buffer to take bytes from in flush mode</dd>
<dd><code>to</code> - Buffer to put bytes to in flush mode. The buffer is flipToFill before the put and flipToFlush after.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>number of bytes moved</dd>
</dl>
</li>
</ul>
<a id="append(java.nio.ByteBuffer,byte[],int,int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>append</h4>
<pre class="methodSignature">public static&nbsp;void&nbsp;append&#8203;(java.nio.ByteBuffer&nbsp;to,
byte[]&nbsp;b,
int&nbsp;off,
int&nbsp;len)
throws java.nio.BufferOverflowException</pre>
<div class="block">Append bytes to a buffer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>to</code> - Buffer is flush mode</dd>
<dd><code>b</code> - bytes to append</dd>
<dd><code>off</code> - offset into byte</dd>
<dd><code>len</code> - length to append</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.nio.BufferOverflowException</code> - if unable to append buffer due to space limits</dd>
</dl>
</li>
</ul>
<a id="append(java.nio.ByteBuffer,byte)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>append</h4>
<pre class="methodSignature">public static&nbsp;void&nbsp;append&#8203;(java.nio.ByteBuffer&nbsp;to,
byte&nbsp;b)</pre>
<div class="block">Appends a byte to a buffer</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>to</code> - Buffer is flush mode</dd>
<dd><code>b</code> - byte to append</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.nio.BufferOverflowException</code> - if unable to append buffer due to space limits</dd>
</dl>
</li>
</ul>
<a id="append(java.nio.ByteBuffer,java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>append</h4>
<pre class="methodSignature">public static&nbsp;int&nbsp;append&#8203;(java.nio.ByteBuffer&nbsp;to,
java.nio.ByteBuffer&nbsp;b)</pre>
<div class="block">Appends a buffer to a buffer</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>to</code> - Buffer is flush mode</dd>
<dd><code>b</code> - buffer to append</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The position of the valid data before the flipped position.</dd>
</dl>
</li>
</ul>
<a id="fill(java.nio.ByteBuffer,byte[],int,int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>fill</h4>
<pre class="methodSignature">public static&nbsp;int&nbsp;fill&#8203;(java.nio.ByteBuffer&nbsp;to,
byte[]&nbsp;b,
int&nbsp;off,
int&nbsp;len)</pre>
<div class="block">Like append, but does not throw <code>BufferOverflowException</code></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>to</code> - Buffer The buffer to fill to. The buffer will be flipped to fill mode and then flipped back to flush mode.</dd>
<dd><code>b</code> - bytes The bytes to fill</dd>
<dd><code>off</code> - offset into bytes</dd>
<dd><code>len</code> - length to fill</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the number of bytes taken from the buffer.</dd>
</dl>
</li>
</ul>
<a id="readFrom(java.io.File,java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readFrom</h4>
<pre class="methodSignature">public static&nbsp;void&nbsp;readFrom&#8203;(java.io.File&nbsp;file,
java.nio.ByteBuffer&nbsp;buffer)
throws java.io.IOException</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code></dd>
</dl>
</li>
</ul>
<a id="readFrom(java.io.InputStream,int,java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readFrom</h4>
<pre class="methodSignature">public static&nbsp;void&nbsp;readFrom&#8203;(java.io.InputStream&nbsp;is,
int&nbsp;needed,
java.nio.ByteBuffer&nbsp;buffer)
throws java.io.IOException</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code></dd>
</dl>
</li>
</ul>
<a id="writeTo(java.nio.ByteBuffer,java.io.OutputStream)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeTo</h4>
<pre class="methodSignature">public static&nbsp;void&nbsp;writeTo&#8203;(java.nio.ByteBuffer&nbsp;buffer,
java.io.OutputStream&nbsp;out)
throws java.io.IOException</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code></dd>
</dl>
</li>
</ul>
<a id="toString(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre class="methodSignature">public static&nbsp;java.lang.String&nbsp;toString&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Convert the buffer to an ISO-8859-1 String</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - The buffer to convert in flush mode. The buffer is unchanged</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The buffer as a string.</dd>
</dl>
</li>
</ul>
<a id="toUTF8String(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toUTF8String</h4>
<pre class="methodSignature">public static&nbsp;java.lang.String&nbsp;toUTF8String&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Convert the buffer to an UTF-8 String</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - The buffer to convert in flush mode. The buffer is unchanged</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The buffer as a string.</dd>
</dl>
</li>
</ul>
<a id="toString(java.nio.ByteBuffer,java.nio.charset.Charset)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre class="methodSignature">public static&nbsp;java.lang.String&nbsp;toString&#8203;(java.nio.ByteBuffer&nbsp;buffer,
java.nio.charset.Charset&nbsp;charset)</pre>
<div class="block">Convert the buffer to an ISO-8859-1 String</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - The buffer to convert in flush mode. The buffer is unchanged</dd>
<dd><code>charset</code> - The <code>Charset</code> to use to convert the bytes</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The buffer as a string.</dd>
</dl>
</li>
</ul>
<a id="toString(java.nio.ByteBuffer,int,int,java.nio.charset.Charset)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre class="methodSignature">public static&nbsp;java.lang.String&nbsp;toString&#8203;(java.nio.ByteBuffer&nbsp;buffer,
int&nbsp;position,
int&nbsp;length,
java.nio.charset.Charset&nbsp;charset)</pre>
<div class="block">Convert a partial buffer to a String.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - the buffer to convert</dd>
<dd><code>position</code> - The position in the buffer to start the string from</dd>
<dd><code>length</code> - The length of the buffer</dd>
<dd><code>charset</code> - The <code>Charset</code> to use to convert the bytes</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The buffer as a string.</dd>
</dl>
</li>
</ul>
<a id="toInt(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toInt</h4>
<pre class="methodSignature">public static&nbsp;int&nbsp;toInt&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Convert buffer to an integer. Parses up to the first non-numeric character. If no number is found an IllegalArgumentException is thrown</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - A buffer containing an integer in flush mode. The position is not changed.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an int</dd>
</dl>
</li>
</ul>
<a id="toInt(java.nio.ByteBuffer,int,int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toInt</h4>
<pre class="methodSignature">public static&nbsp;int&nbsp;toInt&#8203;(java.nio.ByteBuffer&nbsp;buffer,
int&nbsp;position,
int&nbsp;length)</pre>
<div class="block">Convert buffer to an integer. Parses up to the first non-numeric character. If no number is found an
IllegalArgumentException is thrown</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - A buffer containing an integer in flush mode. The position is not changed.</dd>
<dd><code>position</code> - the position in the buffer to start reading from</dd>
<dd><code>length</code> - the length of the buffer to use for conversion</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an int of the buffer bytes</dd>
</dl>
</li>
</ul>
<a id="takeInt(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>takeInt</h4>
<pre class="methodSignature">public static&nbsp;int&nbsp;takeInt&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Convert buffer to an integer. Parses up to the first non-numeric character. If no number is found an IllegalArgumentException is thrown</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - A buffer containing an integer in flush mode. The position is updated.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an int</dd>
</dl>
</li>
</ul>
<a id="toLong(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toLong</h4>
<pre class="methodSignature">public static&nbsp;long&nbsp;toLong&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Convert buffer to an long. Parses up to the first non-numeric character. If no number is found an IllegalArgumentException is thrown</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - A buffer containing an integer in flush mode. The position is not changed.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an int</dd>
</dl>
</li>
</ul>
<a id="putHexInt(java.nio.ByteBuffer,int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putHexInt</h4>
<pre class="methodSignature">public static&nbsp;void&nbsp;putHexInt&#8203;(java.nio.ByteBuffer&nbsp;buffer,
int&nbsp;n)</pre>
</li>
</ul>
<a id="putDecInt(java.nio.ByteBuffer,int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putDecInt</h4>
<pre class="methodSignature">public static&nbsp;void&nbsp;putDecInt&#8203;(java.nio.ByteBuffer&nbsp;buffer,
int&nbsp;n)</pre>
</li>
</ul>
<a id="putDecLong(java.nio.ByteBuffer,long)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putDecLong</h4>
<pre class="methodSignature">public static&nbsp;void&nbsp;putDecLong&#8203;(java.nio.ByteBuffer&nbsp;buffer,
long&nbsp;n)</pre>
</li>
</ul>
<a id="toBuffer(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toBuffer</h4>
<pre class="methodSignature">public static&nbsp;java.nio.ByteBuffer&nbsp;toBuffer&#8203;(int&nbsp;value)</pre>
</li>
</ul>
<a id="toBuffer(long)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toBuffer</h4>
<pre class="methodSignature">public static&nbsp;java.nio.ByteBuffer&nbsp;toBuffer&#8203;(long&nbsp;value)</pre>
</li>
</ul>
<a id="toBuffer(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toBuffer</h4>
<pre class="methodSignature">public static&nbsp;java.nio.ByteBuffer&nbsp;toBuffer&#8203;(java.lang.String&nbsp;s)</pre>
</li>
</ul>
<a id="toBuffer(java.lang.String,java.nio.charset.Charset)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toBuffer</h4>
<pre class="methodSignature">public static&nbsp;java.nio.ByteBuffer&nbsp;toBuffer&#8203;(java.lang.String&nbsp;s,
java.nio.charset.Charset&nbsp;charset)</pre>
</li>
</ul>
<a id="toBuffer(byte[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toBuffer</h4>
<pre class="methodSignature">public static&nbsp;java.nio.ByteBuffer&nbsp;toBuffer&#8203;(byte[]&nbsp;array)</pre>
<div class="block">Create a new ByteBuffer using provided byte array.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>array</code> - the byte array to back buffer with.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>ByteBuffer with provided byte array, in flush mode</dd>
</dl>
</li>
</ul>
<a id="toBuffer(byte[],int,int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toBuffer</h4>
<pre class="methodSignature">public static&nbsp;java.nio.ByteBuffer&nbsp;toBuffer&#8203;(byte[]&nbsp;array,
int&nbsp;offset,
int&nbsp;length)</pre>
<div class="block">Create a new ByteBuffer using the provided byte array.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>array</code> - the byte array to use.</dd>
<dd><code>offset</code> - the offset within the byte array to use from</dd>
<dd><code>length</code> - the length in bytes of the array to use</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>ByteBuffer with provided byte array, in flush mode</dd>
</dl>
</li>
</ul>
<a id="toDirectBuffer(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toDirectBuffer</h4>
<pre class="methodSignature">public static&nbsp;java.nio.ByteBuffer&nbsp;toDirectBuffer&#8203;(java.lang.String&nbsp;s)</pre>
</li>
</ul>
<a id="toDirectBuffer(java.lang.String,java.nio.charset.Charset)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toDirectBuffer</h4>
<pre class="methodSignature">public static&nbsp;java.nio.ByteBuffer&nbsp;toDirectBuffer&#8203;(java.lang.String&nbsp;s,
java.nio.charset.Charset&nbsp;charset)</pre>
</li>
</ul>
<a id="toMappedBuffer(java.io.File)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toMappedBuffer</h4>
<pre class="methodSignature">public static&nbsp;java.nio.ByteBuffer&nbsp;toMappedBuffer&#8203;(java.io.File&nbsp;file)
throws java.io.IOException</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code></dd>
</dl>
</li>
</ul>
<a id="isMappedBuffer(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isMappedBuffer</h4>
<pre class="methodSignature">@Deprecated
public static&nbsp;boolean&nbsp;isMappedBuffer&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="deprecationBlock"><span class="deprecatedLabel">Deprecated.</span>
<div class="deprecationComment">don't use - there is no way to reliably tell if a ByteBuffer is mapped.</div>
</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - the buffer to test</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>false</code></dd>
</dl>
</li>
</ul>
<a id="toBuffer(org.eclipse.jetty.util.resource.Resource,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toBuffer</h4>
<pre class="methodSignature">public static&nbsp;java.nio.ByteBuffer&nbsp;toBuffer&#8203;(<a href="resource/Resource.html" title="class in org.eclipse.jetty.util.resource">Resource</a>&nbsp;resource,
boolean&nbsp;direct)
throws java.io.IOException</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code></dd>
</dl>
</li>
</ul>
<a id="toSummaryString(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toSummaryString</h4>
<pre class="methodSignature">public static&nbsp;java.lang.String&nbsp;toSummaryString&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
</li>
</ul>
<a id="toDetailString(java.nio.ByteBuffer[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toDetailString</h4>
<pre class="methodSignature">public static&nbsp;java.lang.String&nbsp;toDetailString&#8203;(java.nio.ByteBuffer[]&nbsp;buffer)</pre>
</li>
</ul>
<a id="toIDString(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toIDString</h4>
<pre class="methodSignature">public static&nbsp;java.lang.String&nbsp;toIDString&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Convert Buffer to string ID independent of content</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - the buffet to generate a string ID from</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A string showing the buffer ID</dd>
</dl>
</li>
</ul>
<a id="toDetailString(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toDetailString</h4>
<pre class="methodSignature">public static&nbsp;java.lang.String&nbsp;toDetailString&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Convert Buffer to a detail debug string of pointers and content</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - the buffer to generate a detail string from</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A string showing the pointers and content of the buffer</dd>
</dl>
</li>
</ul>
<a id="toHexSummary(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toHexSummary</h4>
<pre class="methodSignature">public static&nbsp;java.lang.String&nbsp;toHexSummary&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Convert buffer to a Hex Summary String.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - the buffer to generate a hex byte summary from</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A string showing a summary of the content in hex</dd>
</dl>
</li>
</ul>
<a id="toHexString(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toHexString</h4>
<pre class="methodSignature">public static&nbsp;java.lang.String&nbsp;toHexString&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
<div class="block">Convert buffer to a Hex String.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - the buffer to generate a hex byte summary from</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A hex string</dd>
</dl>
</li>
</ul>
<a id="putCRLF(java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putCRLF</h4>
<pre class="methodSignature">public static&nbsp;void&nbsp;putCRLF&#8203;(java.nio.ByteBuffer&nbsp;buffer)</pre>
</li>
</ul>
<a id="isPrefix(java.nio.ByteBuffer,java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isPrefix</h4>
<pre class="methodSignature">public static&nbsp;boolean&nbsp;isPrefix&#8203;(java.nio.ByteBuffer&nbsp;prefix,
java.nio.ByteBuffer&nbsp;buffer)</pre>
</li>
</ul>
<a id="ensureCapacity(java.nio.ByteBuffer,int)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>ensureCapacity</h4>
<pre class="methodSignature">public static&nbsp;java.nio.ByteBuffer&nbsp;ensureCapacity&#8203;(java.nio.ByteBuffer&nbsp;buffer,
int&nbsp;capacity)</pre>
</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/BufferUtil.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>Nested&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="subNavList">
<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>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Copyright &#169; 1995&#x2013;2020 <a href="https://webtide.com">Webtide</a>. All rights reserved.</small></p>
</footer>
</body>
</html>