blob: 5b87809298fdd1a71b26b8fe66eca91aa83fd2d1 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_60) on Wed Feb 03 10:01:29 CET 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ByteUtilities (Apache MINA 2.0.12 API)</title>
<meta name="date" content="2016-02-03">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ByteUtilities (Apache MINA 2.0.12 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9,"i12":9,"i13":9,"i14":9,"i15":9,"i16":9,"i17":9,"i18":9,"i19":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/ByteUtilities.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">
<li>Prev&nbsp;Class</li>
<li><a href="../../../../../org/apache/mina/proxy/utils/IoBufferDecoder.html" title="class in org.apache.mina.proxy.utils"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/mina/proxy/utils/ByteUtilities.html" target="_top">Frames</a></li>
<li><a href="ByteUtilities.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></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>
</div>
<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>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.mina.proxy.utils</div>
<h2 title="Class ByteUtilities" class="title">Class ByteUtilities</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.mina.proxy.utils.ByteUtilities</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.30">ByteUtilities</a>
extends <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">ByteUtilities.java - Byte manipulation functions.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>MINA 2.0.0-M3</dd>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd><a href="http://mina.apache.org">Apache MINA Project</a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#ByteUtilities--">ByteUtilities</a></span>()</code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<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></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#asByteArray-java.lang.String-">asByteArray</a></span>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;hex)</code>
<div class="block">Converts a hex string representation to a byte array.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#asHex-byte:A-">asHex</a></span>(byte[]&nbsp;bytes)</code>
<div class="block">Returns a hexadecimal representation of the given byte array.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#asHex-byte:A-java.lang.String-">asHex</a></span>(byte[]&nbsp;bytes,
<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;separator)</code>
<div class="block">Returns a hexadecimal representation of the given byte array.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#changeByteEndianess-byte:A-int-int-">changeByteEndianess</a></span>(byte[]&nbsp;b,
int&nbsp;offset,
int&nbsp;length)</code>
<div class="block">Invert two bytes in the given byte array starting at the given
offset and repeating the inversion length/2 times.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#changeWordEndianess-byte:A-int-int-">changeWordEndianess</a></span>(byte[]&nbsp;b,
int&nbsp;offset,
int&nbsp;length)</code>
<div class="block">Invert the endianness of words (4 bytes) in the given byte array
starting at the given offset and repeating length/4 times.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#encodeString-java.lang.String-boolean-">encodeString</a></span>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;s,
boolean&nbsp;useUnicode)</code>
<div class="block">Encodes the string to a byte array using UTF-16LE or the ASCII charset
in function of the <code>useUnicode</code> argument.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#getOEMStringAsByteArray-java.lang.String-">getOEMStringAsByteArray</a></span>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;s)</code>
<div class="block">Converts an OEM string as defined in NTLM protocol (eg ASCII charset)
to a byte array.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#getUTFStringAsByteArray-java.lang.String-">getUTFStringAsByteArray</a></span>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;s)</code>
<div class="block">Converts an UTF-16LE string as defined in NTLM protocol to a byte array.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#intToNetworkByteOrder-int-byte:A-int-int-">intToNetworkByteOrder</a></span>(int&nbsp;num,
byte[]&nbsp;buf,
int&nbsp;start,
int&nbsp;count)</code>
<div class="block">Encodes an integer into up to 4 bytes in network byte order in the
supplied buffer starting at <code>start</code> offset and writing
<code>count</code> bytes.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#intToNetworkByteOrder-int-int-">intToNetworkByteOrder</a></span>(int&nbsp;num,
int&nbsp;count)</code>
<div class="block">Encodes an integer into up to 4 bytes in network byte order.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#isFlagSet-int-int-">isFlagSet</a></span>(int&nbsp;flagSet,
int&nbsp;testFlag)</code>
<div class="block">Returns true if the flag <code>testFlag</code> is set in the
<code>flags</code> flagset.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte2-byte:A-">makeIntFromByte2</a></span>(byte[]&nbsp;b)</code>
<div class="block">Reads an int from 2 bytes of the given array at offset 0.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte2-byte:A-int-">makeIntFromByte2</a></span>(byte[]&nbsp;b,
int&nbsp;offset)</code>
<div class="block">Reads an int from 2 bytes of the given array at the given offset.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte4-byte:A-">makeIntFromByte4</a></span>(byte[]&nbsp;b)</code>
<div class="block">Reads an int from 4 bytes of the given array at offset 0.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte4-byte:A-int-">makeIntFromByte4</a></span>(byte[]&nbsp;b,
int&nbsp;offset)</code>
<div class="block">Reads an int from 4 bytes of the given array at the given offset.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#networkByteOrderToInt-byte:A-int-int-">networkByteOrderToInt</a></span>(byte[]&nbsp;buf,
int&nbsp;start,
int&nbsp;count)</code>
<div class="block">Returns the integer represented by up to 4 bytes in network byte order.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeInt-int-">writeInt</a></span>(int&nbsp;v)</code>
<div class="block">Write a 32 bit int as LITTLE_ENDIAN.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeInt-int-byte:A-int-">writeInt</a></span>(int&nbsp;v,
byte[]&nbsp;b,
int&nbsp;offset)</code>
<div class="block">Write a 32 bit int as LITTLE_ENDIAN to
the given array <code>b</code> at offset <code>offset</code>.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeShort-short-">writeShort</a></span>(short&nbsp;v)</code>
<div class="block">Write a 16 bit short as LITTLE_ENDIAN.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeShort-short-byte:A-int-">writeShort</a></span>(short&nbsp;v,
byte[]&nbsp;b,
int&nbsp;offset)</code>
<div class="block">Write a 16 bit short as LITTLE_ENDIAN to
the given array <code>b</code> at offset <code>offset</code>.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="ByteUtilities--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>ByteUtilities</h4>
<pre>public&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.30">ByteUtilities</a>()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="networkByteOrderToInt-byte:A-int-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>networkByteOrderToInt</h4>
<pre>public static&nbsp;int&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.40">networkByteOrderToInt</a>(byte[]&nbsp;buf,
int&nbsp;start,
int&nbsp;count)</pre>
<div class="block">Returns the integer represented by up to 4 bytes in network byte order.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buf</code> - the buffer to read the bytes from</dd>
<dd><code>start</code> - The starting position</dd>
<dd><code>count</code> - The number of bytes to in the buffer</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the integer value</dd>
</dl>
</li>
</ul>
<a name="intToNetworkByteOrder-int-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>intToNetworkByteOrder</h4>
<pre>public static&nbsp;byte[]&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.62">intToNetworkByteOrder</a>(int&nbsp;num,
int&nbsp;count)</pre>
<div class="block">Encodes an integer into up to 4 bytes in network byte order.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>num</code> - the int to convert to a byte array</dd>
<dd><code>count</code> - the number of reserved bytes for the write operation</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the resulting byte array</dd>
</dl>
</li>
</ul>
<a name="intToNetworkByteOrder-int-byte:A-int-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>intToNetworkByteOrder</h4>
<pre>public static&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.79">intToNetworkByteOrder</a>(int&nbsp;num,
byte[]&nbsp;buf,
int&nbsp;start,
int&nbsp;count)</pre>
<div class="block">Encodes an integer into up to 4 bytes in network byte order in the
supplied buffer starting at <code>start</code> offset and writing
<code>count</code> bytes.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>num</code> - the int to convert to a byte array</dd>
<dd><code>buf</code> - the buffer to write the bytes to</dd>
<dd><code>start</code> - the offset from beginning for the write operation</dd>
<dd><code>count</code> - the number of reserved bytes for the write operation</dd>
</dl>
</li>
</ul>
<a name="writeShort-short-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeShort</h4>
<pre>public static final&nbsp;byte[]&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.96">writeShort</a>(short&nbsp;v)</pre>
<div class="block">Write a 16 bit short as LITTLE_ENDIAN.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>v</code> - the short to write</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the Short in a byte[]</dd>
</dl>
</li>
</ul>
<a name="writeShort-short-byte:A-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeShort</h4>
<pre>public static final&nbsp;byte[]&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.109">writeShort</a>(short&nbsp;v,
byte[]&nbsp;b,
int&nbsp;offset)</pre>
<div class="block">Write a 16 bit short as LITTLE_ENDIAN to
the given array <code>b</code> at offset <code>offset</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>v</code> - the short to write</dd>
<dd><code>b</code> - the byte array to write to</dd>
<dd><code>offset</code> - the offset at which to start writing in the array</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the Short in a byte[]</dd>
</dl>
</li>
</ul>
<a name="writeInt-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeInt</h4>
<pre>public static final&nbsp;byte[]&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.122">writeInt</a>(int&nbsp;v)</pre>
<div class="block">Write a 32 bit int as LITTLE_ENDIAN.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>v</code> - the int to write</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the Int in a byte[]</dd>
</dl>
</li>
</ul>
<a name="writeInt-int-byte:A-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeInt</h4>
<pre>public static final&nbsp;byte[]&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.135">writeInt</a>(int&nbsp;v,
byte[]&nbsp;b,
int&nbsp;offset)</pre>
<div class="block">Write a 32 bit int as LITTLE_ENDIAN to
the given array <code>b</code> at offset <code>offset</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>v</code> - the int to write</dd>
<dd><code>b</code> - the byte array to write to</dd>
<dd><code>offset</code> - the offset at which to start writing in the array</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the Int in a byte[]</dd>
</dl>
</li>
</ul>
<a name="changeWordEndianess-byte:A-int-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>changeWordEndianess</h4>
<pre>public static final&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.154">changeWordEndianess</a>(byte[]&nbsp;b,
int&nbsp;offset,
int&nbsp;length)</pre>
<div class="block">Invert the endianness of words (4 bytes) in the given byte array
starting at the given offset and repeating length/4 times.
eg: b0b1b2b3 -&gt; b3b2b1b0</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>b</code> - the byte array</dd>
<dd><code>offset</code> - the offset at which to change word start</dd>
<dd><code>length</code> - the number of bytes on which to operate
(should be a multiple of 4)</dd>
</dl>
</li>
</ul>
<a name="changeByteEndianess-byte:A-int-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>changeByteEndianess</h4>
<pre>public static final&nbsp;void&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.177">changeByteEndianess</a>(byte[]&nbsp;b,
int&nbsp;offset,
int&nbsp;length)</pre>
<div class="block">Invert two bytes in the given byte array starting at the given
offset and repeating the inversion length/2 times.
eg: b0b1 -@gt; b1b0</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>b</code> - the byte array</dd>
<dd><code>offset</code> - the offset at which to change word start</dd>
<dd><code>length</code> - the number of bytes on which to operate
(should be a multiple of 2)</dd>
</dl>
</li>
</ul>
<a name="getOEMStringAsByteArray-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getOEMStringAsByteArray</h4>
<pre>public static final&nbsp;byte[]&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.195">getOEMStringAsByteArray</a>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;s)
throws <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</a></pre>
<div class="block">Converts an OEM string as defined in NTLM protocol (eg ASCII charset)
to a byte array.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>s</code> - the string to convert</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the result byte array</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</a></code> - if the string is not an OEM string</dd>
</dl>
</li>
</ul>
<a name="getUTFStringAsByteArray-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getUTFStringAsByteArray</h4>
<pre>public static final&nbsp;byte[]&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.206">getUTFStringAsByteArray</a>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;s)
throws <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</a></pre>
<div class="block">Converts an UTF-16LE string as defined in NTLM protocol to a byte array.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>s</code> - the string to convert</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the result byte array</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</a></code> - if the string is not an UTF-16LE string</dd>
</dl>
</li>
</ul>
<a name="encodeString-java.lang.String-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>encodeString</h4>
<pre>public static final&nbsp;byte[]&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.220">encodeString</a>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;s,
boolean&nbsp;useUnicode)
throws <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</a></pre>
<div class="block">Encodes the string to a byte array using UTF-16LE or the ASCII charset
in function of the <code>useUnicode</code> argument.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>s</code> - the string to encode</dd>
<dd><code>useUnicode</code> - if true then string is encoded to UTF-16LE
otherwise to ASCII</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the encoded string as a byte array</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/io/UnsupportedEncodingException.html?is-external=true" title="class or interface in java.io">UnsupportedEncodingException</a></code> - if encoding fails</dd>
</dl>
</li>
</ul>
<a name="asHex-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>asHex</h4>
<pre>public static&nbsp;<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.234">asHex</a>(byte[]&nbsp;bytes)</pre>
<div class="block">Returns a hexadecimal representation of the given byte array.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>bytes</code> - the array to output to an hex string</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the hex representation as a string</dd>
</dl>
</li>
</ul>
<a name="asHex-byte:A-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>asHex</h4>
<pre>public static&nbsp;<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.246">asHex</a>(byte[]&nbsp;bytes,
<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;separator)</pre>
<div class="block">Returns a hexadecimal representation of the given byte array.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>bytes</code> - the array to output to an hex string</dd>
<dd><code>separator</code> - the separator to use between each byte in the output
string. If null no char is inserted between each byte value.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the hex representation as a string</dd>
</dl>
</li>
</ul>
<a name="asByteArray-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>asByteArray</h4>
<pre>public static&nbsp;byte[]&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.270">asByteArray</a>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;hex)</pre>
<div class="block">Converts a hex string representation to a byte array.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>hex</code> - the string holding the hex values</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the resulting byte array</dd>
</dl>
</li>
</ul>
<a name="makeIntFromByte4-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>makeIntFromByte4</h4>
<pre>public static final&nbsp;int&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.285">makeIntFromByte4</a>(byte[]&nbsp;b)</pre>
<div class="block">Reads an int from 4 bytes of the given array at offset 0.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>b</code> - the byte array to read</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the integer value</dd>
</dl>
</li>
</ul>
<a name="makeIntFromByte4-byte:A-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>makeIntFromByte4</h4>
<pre>public static final&nbsp;int&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.296">makeIntFromByte4</a>(byte[]&nbsp;b,
int&nbsp;offset)</pre>
<div class="block">Reads an int from 4 bytes of the given array at the given offset.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>b</code> - the byte array to read</dd>
<dd><code>offset</code> - the offset at which to start</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the int value</dd>
</dl>
</li>
</ul>
<a name="makeIntFromByte2-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>makeIntFromByte2</h4>
<pre>public static final&nbsp;int&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.306">makeIntFromByte2</a>(byte[]&nbsp;b)</pre>
<div class="block">Reads an int from 2 bytes of the given array at offset 0.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>b</code> - the byte array to read</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the int value</dd>
</dl>
</li>
</ul>
<a name="makeIntFromByte2-byte:A-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>makeIntFromByte2</h4>
<pre>public static final&nbsp;int&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.317">makeIntFromByte2</a>(byte[]&nbsp;b,
int&nbsp;offset)</pre>
<div class="block">Reads an int from 2 bytes of the given array at the given offset.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>b</code> - the byte array to read</dd>
<dd><code>offset</code> - the offset at which to start</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the int value</dd>
</dl>
</li>
</ul>
<a name="isFlagSet-int-int-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>isFlagSet</h4>
<pre>public static final&nbsp;boolean&nbsp;<a href="../../../../../src-html/org/apache/mina/proxy/utils/ByteUtilities.html#line.329">isFlagSet</a>(int&nbsp;flagSet,
int&nbsp;testFlag)</pre>
<div class="block">Returns true if the flag <code>testFlag</code> is set in the
<code>flags</code> flagset.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>flagSet</code> - the flagset to test</dd>
<dd><code>testFlag</code> - the flag we search the presence of</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if testFlag is present in the flagset, false otherwise.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/ByteUtilities.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">
<li>Prev&nbsp;Class</li>
<li><a href="../../../../../org/apache/mina/proxy/utils/IoBufferDecoder.html" title="class in org.apache.mina.proxy.utils"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/mina/proxy/utils/ByteUtilities.html" target="_top">Frames</a></li>
<li><a href="ByteUtilities.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.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>
</div>
<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>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2004&#x2013;2016 <a href="http://mina.apache.org/">Apache MINA Project</a>. All rights reserved.</small></p>
</body>
</html>