blob: a2b19194da043da9b97d24b0f0e85c95bd2f2aba [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 (version 1.7.0_07) on Tue Oct 02 13:04:15 CEST 2012 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>ByteUtilities (Apache MINA 2.0.6 API)</title>
<meta name="date" content="2012-10-02">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ByteUtilities (Apache MINA 2.0.6 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><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 Class</li>
<li><a href="../../../../../org/apache/mina/proxy/utils/IoBufferDecoder.html" title="class in org.apache.mina.proxy.utils"><span class="strong">Next 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 Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All 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://download.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 <span class="strong">ByteUtilities</span>
extends <a href="http://download.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="strong">Since:</span></dt>
<dd>MINA 2.0.0-M3</dd>
<dt><span class="strong">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="overviewSummary" 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><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#ByteUtilities()">ByteUtilities</a></strong>()</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="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#asByteArray(java.lang.String)">asByteArray</a></strong>(<a href="http://download.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 class="rowColor">
<td class="colFirst"><code>static <a href="http://download.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><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#asHex(byte[])">asHex</a></strong>(byte[]&nbsp;bytes)</code>
<div class="block">Returns a hexadecimal representation of the given byte array.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="http://download.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><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#asHex(byte[], java.lang.String)">asHex</a></strong>(byte[]&nbsp;bytes,
<a href="http://download.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 class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#changeByteEndianess(byte[], int, int)">changeByteEndianess</a></strong>(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 class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#changeWordEndianess(byte[], int, int)">changeWordEndianess</a></strong>(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 class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#encodeString(java.lang.String, boolean)">encodeString</a></strong>(<a href="http://download.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 class="altColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#getOEMStringAsByteArray(java.lang.String)">getOEMStringAsByteArray</a></strong>(<a href="http://download.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 class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#getUTFStringAsByteArray(java.lang.String)">getUTFStringAsByteArray</a></strong>(<a href="http://download.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 class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#intToNetworkByteOrder(int, byte[], int, int)">intToNetworkByteOrder</a></strong>(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 class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#intToNetworkByteOrder(int, int)">intToNetworkByteOrder</a></strong>(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 class="altColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#isFlagSet(int, int)">isFlagSet</a></strong>(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 class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte2(byte[])">makeIntFromByte2</a></strong>(byte[]&nbsp;b)</code>
<div class="block">Reads an int from 2 bytes of the given array at offset 0.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte2(byte[], int)">makeIntFromByte2</a></strong>(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 class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte4(byte[])">makeIntFromByte4</a></strong>(byte[]&nbsp;b)</code>
<div class="block">Reads an int from 4 bytes of the given array at offset 0.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte4(byte[], int)">makeIntFromByte4</a></strong>(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 class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#networkByteOrderToInt(byte[], int, int)">networkByteOrderToInt</a></strong>(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 class="altColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeInt(int)">writeInt</a></strong>(int&nbsp;v)</code>
<div class="block">Write a 32 bit int as LITTLE_ENDIAN.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeInt(int, byte[], int)">writeInt</a></strong>(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 class="altColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeShort(short)">writeShort</a></strong>(short&nbsp;v)</code>
<div class="block">Write a 16 bit short as LITTLE_ENDIAN.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeShort(short, byte[], int)">writeShort</a></strong>(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://download.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://download.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://download.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://download.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://download.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://download.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://download.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://download.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://download.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://download.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://download.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://download.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;ByteUtilities()</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[], int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>networkByteOrderToInt</h4>
<pre>public static&nbsp;int&nbsp;networkByteOrderToInt(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="strong">Parameters:</span></dt><dd><code>buf</code> - the buffer to read the bytes from</dd><dd><code>start</code> - </dd><dd><code>count</code> - </dd>
<dt><span class="strong">Returns:</span></dt><dd></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;intToNetworkByteOrder(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="strong">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="strong">Returns:</span></dt><dd>the resulting byte array</dd></dl>
</li>
</ul>
<a name="intToNetworkByteOrder(int, byte[], int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>intToNetworkByteOrder</h4>
<pre>public static&nbsp;void&nbsp;intToNetworkByteOrder(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="strong">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;writeShort(short&nbsp;v)</pre>
<div class="block">Write a 16 bit short as LITTLE_ENDIAN.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>v</code> - the short to write</dd></dl>
</li>
</ul>
<a name="writeShort(short, byte[], int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeShort</h4>
<pre>public static final&nbsp;byte[]&nbsp;writeShort(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="strong">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></dl>
</li>
</ul>
<a name="writeInt(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeInt</h4>
<pre>public static final&nbsp;byte[]&nbsp;writeInt(int&nbsp;v)</pre>
<div class="block">Write a 32 bit int as LITTLE_ENDIAN.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>v</code> - the int to write</dd></dl>
</li>
</ul>
<a name="writeInt(int, byte[], int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>writeInt</h4>
<pre>public static final&nbsp;byte[]&nbsp;writeInt(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="strong">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></dl>
</li>
</ul>
<a name="changeWordEndianess(byte[], int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>changeWordEndianess</h4>
<pre>public static final&nbsp;void&nbsp;changeWordEndianess(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 -> b3b2b1b0</div>
<dl><dt><span class="strong">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[], int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>changeByteEndianess</h4>
<pre>public static final&nbsp;void&nbsp;changeByteEndianess(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 -> b1b0</div>
<dl><dt><span class="strong">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;getOEMStringAsByteArray(<a href="http://download.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://download.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="strong">Parameters:</span></dt><dd><code>s</code> - the string to convert</dd>
<dt><span class="strong">Returns:</span></dt><dd>the result byte array</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://download.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;getUTFStringAsByteArray(<a href="http://download.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://download.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="strong">Parameters:</span></dt><dd><code>s</code> - the string to convert</dd>
<dt><span class="strong">Returns:</span></dt><dd>the result byte array</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://download.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;encodeString(<a href="http://download.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://download.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="strong">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="strong">Returns:</span></dt><dd>the encoded string as a byte array</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="http://download.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>
<ul class="blockList">
<li class="blockList">
<h4>asHex</h4>
<pre>public static&nbsp;<a href="http://download.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;asHex(byte[]&nbsp;bytes)</pre>
<div class="block">Returns a hexadecimal representation of the given byte array.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>bytes</code> - the array to output to an hex string</dd>
<dt><span class="strong">Returns:</span></dt><dd>the hex representation as a string</dd></dl>
</li>
</ul>
<a name="asHex(byte[], java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>asHex</h4>
<pre>public static&nbsp;<a href="http://download.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;asHex(byte[]&nbsp;bytes,
<a href="http://download.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="strong">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="strong">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;asByteArray(<a href="http://download.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="strong">Parameters:</span></dt><dd><code>hex</code> - the string holding the hex values</dd>
<dt><span class="strong">Returns:</span></dt><dd>the resulting byte array</dd></dl>
</li>
</ul>
<a name="makeIntFromByte4(byte[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>makeIntFromByte4</h4>
<pre>public static final&nbsp;int&nbsp;makeIntFromByte4(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="strong">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="strong">Returns:</span></dt><dd>the int value</dd></dl>
</li>
</ul>
<a name="makeIntFromByte4(byte[], int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>makeIntFromByte4</h4>
<pre>public static final&nbsp;int&nbsp;makeIntFromByte4(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="strong">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="strong">Returns:</span></dt><dd>the int value</dd></dl>
</li>
</ul>
<a name="makeIntFromByte2(byte[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>makeIntFromByte2</h4>
<pre>public static final&nbsp;int&nbsp;makeIntFromByte2(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="strong">Parameters:</span></dt><dd><code>b</code> - the byte array to read</dd>
<dt><span class="strong">Returns:</span></dt><dd>the int value</dd></dl>
</li>
</ul>
<a name="makeIntFromByte2(byte[], int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>makeIntFromByte2</h4>
<pre>public static final&nbsp;int&nbsp;makeIntFromByte2(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="strong">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="strong">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;isFlagSet(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="strong">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="strong">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><a href="#skip-navbar_bottom" title="Skip navigation links"></a><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 Class</li>
<li><a href="../../../../../org/apache/mina/proxy/utils/IoBufferDecoder.html" title="class in org.apache.mina.proxy.utils"><span class="strong">Next 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 Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All 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-2012 <a href="http://mina.apache.org/">Apache MINA Project</a>. All Rights Reserved.</small></p>
</body>
</html>