Minestom/docs/net/minestom/server/utils/binary/BinaryWriter.html
2020-11-15 23:39:49 +01:00

757 lines
35 KiB
HTML

<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>BinaryWriter (Minestom 1.0 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="declaration: package: net.minestom.server.utils.binary, class: BinaryWriter">
<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.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../../script-dir/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../../script-dir/jquery-3.4.1.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-ui.js"></script>
</head>
<body class="class-declaration">
<script type="text/javascript">var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flexBox">
<header role="banner" class="flexHeader">
<nav role="navigation">
<!-- ========= 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="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">
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&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>
<div class="navListSearch"><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="skipNav"><a id="skip.navbar.top">
<!-- -->
</a></div>
</nav>
</header>
<div class="flexContent">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">net.minestom.server.utils.binary</a></div>
<h1 title="Class BinaryWriter" class="title">Class BinaryWriter</h1>
</div>
<div class="contentContainer">
<div class="inheritance" title="Inheritance Tree">java.lang.Object
<div class="inheritance">java.io.OutputStream
<div class="inheritance">net.minestom.server.utils.binary.BinaryWriter</div>
</div>
</div>
<section class="description">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><code>java.io.Closeable</code>, <code>java.io.Flushable</code>, <code>java.lang.AutoCloseable</code></dd>
</dl>
<hr>
<pre>public class <span class="typeNameLabel">BinaryWriter</span>
extends java.io.OutputStream</pre>
<div class="block">Class used to write to a byte array.
WARNING: not thread-safe.</div>
</section>
<section class="summary">
<ul class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li class="blockList">
<section class="constructorSummary"><a id="constructor.summary">
<!-- -->
</a>
<h2>Constructor Summary</h2>
<div class="memberSummary">
<table>
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<thead>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">BinaryWriter</a></span>()</code></th>
<td class="colLast">
<div class="block">Creates a <a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary"><code>BinaryWriter</code></a> with a "reasonably small initial capacity".</div>
</td>
</tr>
<tr class="rowColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(int)">BinaryWriter</a></span>&#8203;(int&nbsp;initialCapacity)</code></th>
<td class="colLast">
<div class="block">Creates a <a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary"><code>BinaryWriter</code></a> using a heap buffer with a custom initial capacity.</div>
</td>
</tr>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(io.netty.buffer.ByteBuf...)">BinaryWriter</a></span>&#8203;(io.netty.buffer.ByteBuf...&nbsp;buffers)</code></th>
<td class="colLast">
<div class="block">Creates a <a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary"><code>BinaryWriter</code></a> from multiple buffers.</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li class="blockList">
<section class="methodSummary"><a id="method.summary">
<!-- -->
</a>
<h2>Method Summary</h2>
<div class="memberSummary">
<div role="tablist" aria-orientation="horizontal"><button role="tab" aria-selected="true" aria-controls="memberSummary_tabpanel" tabindex="0" onkeydown="switchTab(event)" id="t0" class="activeTableTab">All Methods</button><button role="tab" aria-selected="false" aria-controls="memberSummary_tabpanel" tabindex="-1" onkeydown="switchTab(event)" id="t2" class="tableTab" onclick="show(2);">Instance Methods</button><button role="tab" aria-selected="false" aria-controls="memberSummary_tabpanel" tabindex="-1" onkeydown="switchTab(event)" id="t4" class="tableTab" onclick="show(8);">Concrete Methods</button></div>
<div id="memberSummary_tabpanel" role="tabpanel">
<table aria-labelledby="t0">
<thead>
<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>
</thead>
<tbody>
<tr class="altColor" id="i0">
<td class="colFirst"><code>io.netty.buffer.ByteBuf</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getBuffer()">getBuffer</a></span>()</code></th>
<td class="colLast">
<div class="block">Gets the raw buffer used by this binary writer.</div>
</td>
</tr>
<tr class="rowColor" id="i1">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setBuffer(io.netty.buffer.ByteBuf)">setBuffer</a></span>&#8203;(io.netty.buffer.ByteBuf&nbsp;buffer)</code></th>
<td class="colLast">
<div class="block">Changes the buffer used by this binary writer.</div>
</td>
</tr>
<tr class="altColor" id="i2">
<td class="colFirst"><code>byte[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toByteArray()">toByteArray</a></span>()</code></th>
<td class="colLast">
<div class="block">Converts the internal buffer to a byte array.</div>
</td>
</tr>
<tr class="rowColor" id="i3">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#write(int)">write</a></span>&#8203;(int&nbsp;b)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor" id="i4">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#write(java.util.function.Consumer)">write</a></span>&#8203;(java.util.function.Consumer&lt;<a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary">BinaryWriter</a>&gt;&nbsp;consumer)</code></th>
<td class="colLast">
<div class="block">Consumer this object to write at a different time</div>
</td>
</tr>
<tr class="rowColor" id="i5">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeAtEnd(net.minestom.server.utils.binary.BinaryWriter)">writeAtEnd</a></span>&#8203;(<a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary">BinaryWriter</a>&nbsp;footerWriter)</code></th>
<td class="colLast">
<div class="block">Adds a <a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary"><code>BinaryWriter</code></a>'s <code>ByteBuf</code> at the end of this writer.</div>
</td>
</tr>
<tr class="altColor" id="i6">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeAtStart(net.minestom.server.utils.binary.BinaryWriter)">writeAtStart</a></span>&#8203;(<a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary">BinaryWriter</a>&nbsp;headerWriter)</code></th>
<td class="colLast">
<div class="block">Adds a <a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary"><code>BinaryWriter</code></a>'s <code>ByteBuf</code> at the beginning of this writer.</div>
</td>
</tr>
<tr class="rowColor" id="i7">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeBlockPosition(int,int,int)">writeBlockPosition</a></span>&#8203;(int&nbsp;x,
int&nbsp;y,
int&nbsp;z)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor" id="i8">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeBlockPosition(net.minestom.server.utils.BlockPosition)">writeBlockPosition</a></span>&#8203;(<a href="../BlockPosition.html" title="class in net.minestom.server.utils">BlockPosition</a>&nbsp;blockPosition)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor" id="i9">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeBoolean(boolean)">writeBoolean</a></span>&#8203;(boolean&nbsp;b)</code></th>
<td class="colLast">
<div class="block">Writes a single boolean to the buffer.</div>
</td>
</tr>
<tr class="altColor" id="i10">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeByte(byte)">writeByte</a></span>&#8203;(byte&nbsp;b)</code></th>
<td class="colLast">
<div class="block">Writes a single byte to the buffer.</div>
</td>
</tr>
<tr class="rowColor" id="i11">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeBytes(byte%5B%5D)">writeBytes</a></span>&#8203;(byte[]&nbsp;bytes)</code></th>
<td class="colLast">
<div class="block">Writes a byte array.</div>
</td>
</tr>
<tr class="altColor" id="i12">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeChar(char)">writeChar</a></span>&#8203;(char&nbsp;c)</code></th>
<td class="colLast">
<div class="block">Writes a single char to the buffer.</div>
</td>
</tr>
<tr class="rowColor" id="i13">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeDouble(double)">writeDouble</a></span>&#8203;(double&nbsp;d)</code></th>
<td class="colLast">
<div class="block">Writes a single double to the buffer.</div>
</td>
</tr>
<tr class="altColor" id="i14">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeFloat(float)">writeFloat</a></span>&#8203;(float&nbsp;f)</code></th>
<td class="colLast">
<div class="block">Writes a single float to the buffer.</div>
</td>
</tr>
<tr class="rowColor" id="i15">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeInt(int)">writeInt</a></span>&#8203;(int&nbsp;i)</code></th>
<td class="colLast">
<div class="block">Writes a single int to the buffer.</div>
</td>
</tr>
<tr class="altColor" id="i16">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeItemStack(net.minestom.server.item.ItemStack)">writeItemStack</a></span>&#8203;(<a href="../../item/ItemStack.html" title="class in net.minestom.server.item">ItemStack</a>&nbsp;itemStack)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor" id="i17">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeLong(long)">writeLong</a></span>&#8203;(long&nbsp;l)</code></th>
<td class="colLast">
<div class="block">Writes a single long to the buffer.</div>
</td>
</tr>
<tr class="altColor" id="i18">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeNBT(java.lang.String,org.jglrxavpok.hephaistos.nbt.NBT)">writeNBT</a></span>&#8203;(java.lang.String&nbsp;name,
org.jglrxavpok.hephaistos.nbt.NBT&nbsp;tag)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor" id="i19">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeShort(short)">writeShort</a></span>&#8203;(short&nbsp;s)</code></th>
<td class="colLast">
<div class="block">Writes a single short to the buffer.</div>
</td>
</tr>
<tr class="altColor" id="i20">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeShortSizedString(java.lang.String)">writeShortSizedString</a></span>&#8203;(java.lang.String&nbsp;string)</code></th>
<td class="colLast">
<div class="block">Writes a string to the buffer.</div>
</td>
</tr>
<tr class="rowColor" id="i21">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeSizedString(java.lang.String)">writeSizedString</a></span>&#8203;(java.lang.String&nbsp;string)</code></th>
<td class="colLast">
<div class="block">Writes a string to the buffer.</div>
</td>
</tr>
<tr class="altColor" id="i22">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeStringArray(java.lang.String%5B%5D)">writeStringArray</a></span>&#8203;(java.lang.String[]&nbsp;array)</code></th>
<td class="colLast">
<div class="block">Writes a string to the buffer.</div>
</td>
</tr>
<tr class="rowColor" id="i23">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeUuid(java.util.UUID)">writeUuid</a></span>&#8203;(java.util.UUID&nbsp;uuid)</code></th>
<td class="colLast">
<div class="block">Writes an <code>UUID</code>.</div>
</td>
</tr>
<tr class="altColor" id="i24">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeVarInt(int)">writeVarInt</a></span>&#8203;(int&nbsp;i)</code></th>
<td class="colLast">
<div class="block">Writes a single var-int to the buffer.</div>
</td>
</tr>
<tr class="rowColor" id="i25">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeVarIntArray(int%5B%5D)">writeVarIntArray</a></span>&#8203;(int[]&nbsp;array)</code></th>
<td class="colLast">
<div class="block">Writes a var-int array to the buffer.</div>
</td>
</tr>
<tr class="altColor" id="i26">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#writeVarLong(long)">writeVarLong</a></span>&#8203;(long&nbsp;l)</code></th>
<td class="colLast">
<div class="block">Writes a single var-long to the buffer.</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="inheritedList">
<h3>Methods inherited from class&nbsp;java.io.OutputStream</h3>
<a id="methods.inherited.from.class.java.io.OutputStream">
<!-- -->
</a><code>close, flush, nullOutputStream, write, write</code></div>
<div class="inheritedList">
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a><code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li class="blockList">
<section class="constructorDetails"><a id="constructor.detail">
<!-- -->
</a>
<h2>Constructor Details</h2>
<ul class="blockList">
<li class="blockList">
<section class="detail">
<h3><a id="&lt;init&gt;(int)">BinaryWriter</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="memberName">BinaryWriter</span>&#8203;(<span class="arguments">int&nbsp;initialCapacity)</span></div>
<div class="block">Creates a <a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary"><code>BinaryWriter</code></a> using a heap buffer with a custom initial capacity.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>initialCapacity</code> - the initial capacity of the binary writer</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="&lt;init&gt;(io.netty.buffer.ByteBuf...)">BinaryWriter</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="memberName">BinaryWriter</span>&#8203;(<span class="arguments">io.netty.buffer.ByteBuf...&nbsp;buffers)</span></div>
<div class="block">Creates a <a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary"><code>BinaryWriter</code></a> from multiple buffers.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffers</code> - the buffers making this</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="&lt;init&gt;()">BinaryWriter</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="memberName">BinaryWriter</span>()</div>
<div class="block">Creates a <a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary"><code>BinaryWriter</code></a> with a "reasonably small initial capacity".</div>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li class="blockList">
<section class="methodDetails"><a id="method.detail">
<!-- -->
</a>
<h2>Method Details</h2>
<ul class="blockList">
<li class="blockList">
<section class="detail">
<h3><a id="writeBoolean(boolean)">writeBoolean</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeBoolean</span>&#8203;(<span class="arguments">boolean&nbsp;b)</span></div>
<div class="block">Writes a single boolean to the buffer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>b</code> - the boolean to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeByte(byte)">writeByte</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeByte</span>&#8203;(<span class="arguments">byte&nbsp;b)</span></div>
<div class="block">Writes a single byte to the buffer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>b</code> - the byte to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeChar(char)">writeChar</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeChar</span>&#8203;(<span class="arguments">char&nbsp;c)</span></div>
<div class="block">Writes a single char to the buffer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>c</code> - the char to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeShort(short)">writeShort</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeShort</span>&#8203;(<span class="arguments">short&nbsp;s)</span></div>
<div class="block">Writes a single short to the buffer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>s</code> - the short to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeInt(int)">writeInt</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeInt</span>&#8203;(<span class="arguments">int&nbsp;i)</span></div>
<div class="block">Writes a single int to the buffer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>i</code> - the int to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeLong(long)">writeLong</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeLong</span>&#8203;(<span class="arguments">long&nbsp;l)</span></div>
<div class="block">Writes a single long to the buffer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>l</code> - the long to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeFloat(float)">writeFloat</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeFloat</span>&#8203;(<span class="arguments">float&nbsp;f)</span></div>
<div class="block">Writes a single float to the buffer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>f</code> - the float to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeDouble(double)">writeDouble</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeDouble</span>&#8203;(<span class="arguments">double&nbsp;d)</span></div>
<div class="block">Writes a single double to the buffer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>d</code> - the double to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeVarInt(int)">writeVarInt</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeVarInt</span>&#8203;(<span class="arguments">int&nbsp;i)</span></div>
<div class="block">Writes a single var-int to the buffer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>i</code> - the int to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeVarLong(long)">writeVarLong</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeVarLong</span>&#8203;(<span class="arguments">long&nbsp;l)</span></div>
<div class="block">Writes a single var-long to the buffer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>l</code> - the long to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeSizedString(java.lang.String)">writeSizedString</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeSizedString</span>&#8203;(<span class="arguments">java.lang.String&nbsp;string)</span></div>
<div class="block">Writes a string to the buffer.
<p>
The size is a var-int type.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>string</code> - the string to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeShortSizedString(java.lang.String)">writeShortSizedString</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeShortSizedString</span>&#8203;(<span class="arguments">java.lang.String&nbsp;string)</span></div>
<div class="block">Writes a string to the buffer.
<p>
The size is a short type.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>string</code> - the string to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeVarIntArray(int[])">writeVarIntArray</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeVarIntArray</span>&#8203;(<span class="arguments">int[]&nbsp;array)</span></div>
<div class="block">Writes a var-int array to the buffer.
<p>
It is sized by another var-int at the beginning.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>array</code> - the integers to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeBytes(byte[])">writeBytes</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeBytes</span>&#8203;(<span class="arguments">byte[]&nbsp;bytes)</span></div>
<div class="block">Writes a byte array.
<p>
WARNING: it doesn't write the length of <code>bytes</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>bytes</code> - the byte array to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeStringArray(java.lang.String[])">writeStringArray</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeStringArray</span>&#8203;(<span class="arguments">java.lang.String[]&nbsp;array)</span></div>
<div class="block">Writes a string to the buffer.
<p>
The array is sized by a var-int and all strings are wrote using <a href="#writeSizedString(java.lang.String)"><code>writeSizedString(String)</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>array</code> - the string array to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="write(java.util.function.Consumer)">write</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">write</span>&#8203;(<span class="arguments">java.util.function.Consumer&lt;<a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary">BinaryWriter</a>&gt;&nbsp;consumer)</span></div>
<div class="block">Consumer this object to write at a different time</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>consumer</code> - the writer consumer</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeUuid(java.util.UUID)">writeUuid</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeUuid</span>&#8203;(<span class="arguments">java.util.UUID&nbsp;uuid)</span></div>
<div class="block">Writes an <code>UUID</code>.
It is done by writing both long, the most and least significant bits.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>uuid</code> - the <code>UUID</code> to write</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeBlockPosition(net.minestom.server.utils.BlockPosition)">writeBlockPosition</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeBlockPosition</span>&#8203;(<span class="arguments"><a href="../BlockPosition.html" title="class in net.minestom.server.utils">BlockPosition</a>&nbsp;blockPosition)</span></div>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeBlockPosition(int,int,int)">writeBlockPosition</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeBlockPosition</span>&#8203;(<span class="arguments">int&nbsp;x,
int&nbsp;y,
int&nbsp;z)</span></div>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeItemStack(net.minestom.server.item.ItemStack)">writeItemStack</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeItemStack</span>&#8203;(<span class="arguments"><a href="../../item/ItemStack.html" title="class in net.minestom.server.item">ItemStack</a>&nbsp;itemStack)</span></div>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeNBT(java.lang.String,org.jglrxavpok.hephaistos.nbt.NBT)">writeNBT</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeNBT</span>&#8203;(<span class="arguments">java.lang.String&nbsp;name,
org.jglrxavpok.hephaistos.nbt.NBT&nbsp;tag)</span></div>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="toByteArray()">toByteArray</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">byte[]</span>&nbsp;<span class="memberName">toByteArray</span>()</div>
<div class="block">Converts the internal buffer to a byte array.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the byte array containing all the <a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary"><code>BinaryWriter</code></a> data</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeAtStart(net.minestom.server.utils.binary.BinaryWriter)">writeAtStart</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeAtStart</span>&#8203;(<span class="arguments"><a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary">BinaryWriter</a>&nbsp;headerWriter)</span></div>
<div class="block">Adds a <a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary"><code>BinaryWriter</code></a>'s <code>ByteBuf</code> at the beginning of this writer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>headerWriter</code> - the <a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary"><code>BinaryWriter</code></a> to add at the beginning</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="writeAtEnd(net.minestom.server.utils.binary.BinaryWriter)">writeAtEnd</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">writeAtEnd</span>&#8203;(<span class="arguments"><a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary">BinaryWriter</a>&nbsp;footerWriter)</span></div>
<div class="block">Adds a <a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary"><code>BinaryWriter</code></a>'s <code>ByteBuf</code> at the end of this writer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>footerWriter</code> - the <a href="BinaryWriter.html" title="class in net.minestom.server.utils.binary"><code>BinaryWriter</code></a> to add at the end</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="getBuffer()">getBuffer</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">io.netty.buffer.ByteBuf</span>&nbsp;<span class="memberName">getBuffer</span>()</div>
<div class="block">Gets the raw buffer used by this binary writer.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the raw buffer</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="setBuffer(io.netty.buffer.ByteBuf)">setBuffer</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">setBuffer</span>&#8203;(<span class="arguments">io.netty.buffer.ByteBuf&nbsp;buffer)</span></div>
<div class="block">Changes the buffer used by this binary writer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - the new buffer used by this binary writer</dd>
</dl>
</section>
</li>
<li class="blockList">
<section class="detail">
<h3><a id="write(int)">write</a></h3>
<div class="memberSignature"><span class="modifiers">public</span>&nbsp;<span class="returnType">void</span>&nbsp;<span class="memberName">write</span>&#8203;(<span class="arguments">int&nbsp;b)</span></div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>write</code>&nbsp;in class&nbsp;<code>java.io.OutputStream</code></dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
</div>
<!-- ========= END OF CLASS DATA ========= -->
</main>
<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="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">
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&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>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
</footer>
</div>
</div>
</body>
</html>