blob: 917104bdb68d1da42c67af7ebddcd94fc1d0c7cb [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_24) on Mon Apr 11 23:10:54 CEST 2011 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
ByteUtilities (Apache MINA 2.0.3 API)
</TITLE>
<META NAME="date" CONTENT="2011-04-11">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ByteUtilities (Apache MINA 2.0.3 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ByteUtilities.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../../../org/apache/mina/proxy/utils/IoBufferDecoder.html" title="class in org.apache.mina.proxy.utils"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/mina/proxy/utils/ByteUtilities.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="ByteUtilities.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.mina.proxy.utils</FONT>
<BR>
Class ByteUtilities</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.mina.proxy.utils.ByteUtilities</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>ByteUtilities</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
ByteUtilities.java - Byte manipulation functions.
<P>
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>MINA 2.0.0-M3</DD>
<DT><B>Author:</B></DT>
<DD><a href="http://mina.apache.org">Apache MINA Project</a></DD>
</DL>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#ByteUtilities()">ByteUtilities</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#asByteArray(java.lang.String)">asByteArray</A></B>(java.lang.String&nbsp;hex)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts a hex string representation to a byte array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#asHex(byte[])">asHex</A></B>(byte[]&nbsp;bytes)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a hexadecimal representation of the given byte array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#asHex(byte[], java.lang.String)">asHex</A></B>(byte[]&nbsp;bytes,
java.lang.String&nbsp;separator)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a hexadecimal representation of the given byte array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#changeByteEndianess(byte[], int, int)">changeByteEndianess</A></B>(byte[]&nbsp;b,
int&nbsp;offset,
int&nbsp;length)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Invert two bytes in the given byte array starting at the given
offset and repeating the inversion length/2 times.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#changeWordEndianess(byte[], int, int)">changeWordEndianess</A></B>(byte[]&nbsp;b,
int&nbsp;offset,
int&nbsp;length)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Invert the endianness of words (4 bytes) in the given byte array
starting at the given offset and repeating length/4 times.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#encodeString(java.lang.String, boolean)">encodeString</A></B>(java.lang.String&nbsp;s,
boolean&nbsp;useUnicode)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Encodes the string to a byte array using UTF-16LE or the ASCII charset
in function of the <code>useUnicode</code> argument.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#getOEMStringAsByteArray(java.lang.String)">getOEMStringAsByteArray</A></B>(java.lang.String&nbsp;s)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts an OEM string as defined in NTLM protocol (eg ASCII charset)
to a byte array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#getUTFStringAsByteArray(java.lang.String)">getUTFStringAsByteArray</A></B>(java.lang.String&nbsp;s)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts an UTF-16LE string as defined in NTLM protocol to a byte array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#intToNetworkByteOrder(int, byte[], int, int)">intToNetworkByteOrder</A></B>(int&nbsp;num,
byte[]&nbsp;buf,
int&nbsp;start,
int&nbsp;count)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#intToNetworkByteOrder(int, int)">intToNetworkByteOrder</A></B>(int&nbsp;num,
int&nbsp;count)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Encodes an integer into up to 4 bytes in network byte order.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#isFlagSet(int, int)">isFlagSet</A></B>(int&nbsp;flagSet,
int&nbsp;testFlag)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns true if the flag <code>testFlag</code> is set in the
<code>flags</code> flagset.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte2(byte[])">makeIntFromByte2</A></B>(byte[]&nbsp;b)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads an int from 2 bytes of the given array at offset 0.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte2(byte[], int)">makeIntFromByte2</A></B>(byte[]&nbsp;b,
int&nbsp;offset)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads an int from 2 bytes of the given array at the given offset.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte4(byte[])">makeIntFromByte4</A></B>(byte[]&nbsp;b)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads an int from 4 bytes of the given array at offset 0.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte4(byte[], int)">makeIntFromByte4</A></B>(byte[]&nbsp;b,
int&nbsp;offset)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads an int from 4 bytes of the given array at the given offset.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#networkByteOrderToInt(byte[], int, int)">networkByteOrderToInt</A></B>(byte[]&nbsp;buf,
int&nbsp;start,
int&nbsp;count)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the integer represented by up to 4 bytes in network byte order.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeInt(int)">writeInt</A></B>(int&nbsp;v)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Write a 32 bit int as LITTLE_ENDIAN.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeInt(int, byte[], int)">writeInt</A></B>(int&nbsp;v,
byte[]&nbsp;b,
int&nbsp;offset)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Write a 32 bit int as LITTLE_ENDIAN to
the given array <code>b</code> at offset <code>offset</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeShort(short)">writeShort</A></B>(short&nbsp;v)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Write a 16 bit short as LITTLE_ENDIAN.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeShort(short, byte[], int)">writeShort</A></B>(short&nbsp;v,
byte[]&nbsp;b,
int&nbsp;offset)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Write a 16 bit short as LITTLE_ENDIAN to
the given array <code>b</code> at offset <code>offset</code>.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="ByteUtilities()"><!-- --></A><H3>
ByteUtilities</H3>
<PRE>
public <B>ByteUtilities</B>()</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="networkByteOrderToInt(byte[], int, int)"><!-- --></A><H3>
networkByteOrderToInt</H3>
<PRE>
public static int <B>networkByteOrderToInt</B>(byte[]&nbsp;buf,
int&nbsp;start,
int&nbsp;count)</PRE>
<DL>
<DD>Returns the integer represented by up to 4 bytes in network byte order.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>buf</CODE> - the buffer to read the bytes from<DD><CODE>start</CODE> - <DD><CODE>count</CODE> -
<DT><B>Returns:</B><DD></DL>
</DD>
</DL>
<HR>
<A NAME="intToNetworkByteOrder(int, int)"><!-- --></A><H3>
intToNetworkByteOrder</H3>
<PRE>
public static byte[] <B>intToNetworkByteOrder</B>(int&nbsp;num,
int&nbsp;count)</PRE>
<DL>
<DD>Encodes an integer into up to 4 bytes in network byte order.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>num</CODE> - the int to convert to a byte array<DD><CODE>count</CODE> - the number of reserved bytes for the write operation
<DT><B>Returns:</B><DD>the resulting byte array</DL>
</DD>
</DL>
<HR>
<A NAME="intToNetworkByteOrder(int, byte[], int, int)"><!-- --></A><H3>
intToNetworkByteOrder</H3>
<PRE>
public static void <B>intToNetworkByteOrder</B>(int&nbsp;num,
byte[]&nbsp;buf,
int&nbsp;start,
int&nbsp;count)</PRE>
<DL>
<DD>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.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>num</CODE> - the int to convert to a byte array<DD><CODE>buf</CODE> - the buffer to write the bytes to<DD><CODE>start</CODE> - the offset from beginning for the write operation<DD><CODE>count</CODE> - the number of reserved bytes for the write operation</DL>
</DD>
</DL>
<HR>
<A NAME="writeShort(short)"><!-- --></A><H3>
writeShort</H3>
<PRE>
public static final byte[] <B>writeShort</B>(short&nbsp;v)</PRE>
<DL>
<DD>Write a 16 bit short as LITTLE_ENDIAN.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>v</CODE> - the short to write</DL>
</DD>
</DL>
<HR>
<A NAME="writeShort(short, byte[], int)"><!-- --></A><H3>
writeShort</H3>
<PRE>
public static final byte[] <B>writeShort</B>(short&nbsp;v,
byte[]&nbsp;b,
int&nbsp;offset)</PRE>
<DL>
<DD>Write a 16 bit short as LITTLE_ENDIAN to
the given array <code>b</code> at offset <code>offset</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>v</CODE> - the short to write<DD><CODE>b</CODE> - the byte array to write to<DD><CODE>offset</CODE> - the offset at which to start writing in the array</DL>
</DD>
</DL>
<HR>
<A NAME="writeInt(int)"><!-- --></A><H3>
writeInt</H3>
<PRE>
public static final byte[] <B>writeInt</B>(int&nbsp;v)</PRE>
<DL>
<DD>Write a 32 bit int as LITTLE_ENDIAN.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>v</CODE> - the int to write</DL>
</DD>
</DL>
<HR>
<A NAME="writeInt(int, byte[], int)"><!-- --></A><H3>
writeInt</H3>
<PRE>
public static final byte[] <B>writeInt</B>(int&nbsp;v,
byte[]&nbsp;b,
int&nbsp;offset)</PRE>
<DL>
<DD>Write a 32 bit int as LITTLE_ENDIAN to
the given array <code>b</code> at offset <code>offset</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>v</CODE> - the int to write<DD><CODE>b</CODE> - the byte array to write to<DD><CODE>offset</CODE> - the offset at which to start writing in the array</DL>
</DD>
</DL>
<HR>
<A NAME="changeWordEndianess(byte[], int, int)"><!-- --></A><H3>
changeWordEndianess</H3>
<PRE>
public static final void <B>changeWordEndianess</B>(byte[]&nbsp;b,
int&nbsp;offset,
int&nbsp;length)</PRE>
<DL>
<DD>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
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the byte array<DD><CODE>offset</CODE> - the offset at which to change word start<DD><CODE>length</CODE> - the number of bytes on which to operate
(should be a multiple of 4)</DL>
</DD>
</DL>
<HR>
<A NAME="changeByteEndianess(byte[], int, int)"><!-- --></A><H3>
changeByteEndianess</H3>
<PRE>
public static final void <B>changeByteEndianess</B>(byte[]&nbsp;b,
int&nbsp;offset,
int&nbsp;length)</PRE>
<DL>
<DD>Invert two bytes in the given byte array starting at the given
offset and repeating the inversion length/2 times.
eg: b0b1 -> b1b0
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the byte array<DD><CODE>offset</CODE> - the offset at which to change word start<DD><CODE>length</CODE> - the number of bytes on which to operate
(should be a multiple of 2)</DL>
</DD>
</DL>
<HR>
<A NAME="getOEMStringAsByteArray(java.lang.String)"><!-- --></A><H3>
getOEMStringAsByteArray</H3>
<PRE>
public static final byte[] <B>getOEMStringAsByteArray</B>(java.lang.String&nbsp;s)
throws java.io.UnsupportedEncodingException</PRE>
<DL>
<DD>Converts an OEM string as defined in NTLM protocol (eg ASCII charset)
to a byte array.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - the string to convert
<DT><B>Returns:</B><DD>the result byte array
<DT><B>Throws:</B>
<DD><CODE>java.io.UnsupportedEncodingException</CODE> - if the string is not an OEM string</DL>
</DD>
</DL>
<HR>
<A NAME="getUTFStringAsByteArray(java.lang.String)"><!-- --></A><H3>
getUTFStringAsByteArray</H3>
<PRE>
public static final byte[] <B>getUTFStringAsByteArray</B>(java.lang.String&nbsp;s)
throws java.io.UnsupportedEncodingException</PRE>
<DL>
<DD>Converts an UTF-16LE string as defined in NTLM protocol to a byte array.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - the string to convert
<DT><B>Returns:</B><DD>the result byte array
<DT><B>Throws:</B>
<DD><CODE>java.io.UnsupportedEncodingException</CODE> - if the string is not an UTF-16LE string</DL>
</DD>
</DL>
<HR>
<A NAME="encodeString(java.lang.String, boolean)"><!-- --></A><H3>
encodeString</H3>
<PRE>
public static final byte[] <B>encodeString</B>(java.lang.String&nbsp;s,
boolean&nbsp;useUnicode)
throws java.io.UnsupportedEncodingException</PRE>
<DL>
<DD>Encodes the string to a byte array using UTF-16LE or the ASCII charset
in function of the <code>useUnicode</code> argument.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>s</CODE> - the string to encode<DD><CODE>useUnicode</CODE> - if true then string is encoded to UTF-16LE
otherwise to ASCII
<DT><B>Returns:</B><DD>the encoded string as a byte array
<DT><B>Throws:</B>
<DD><CODE>java.io.UnsupportedEncodingException</CODE> - if encoding fails</DL>
</DD>
</DL>
<HR>
<A NAME="asHex(byte[])"><!-- --></A><H3>
asHex</H3>
<PRE>
public static java.lang.String <B>asHex</B>(byte[]&nbsp;bytes)</PRE>
<DL>
<DD>Returns a hexadecimal representation of the given byte array.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>bytes</CODE> - the array to output to an hex string
<DT><B>Returns:</B><DD>the hex representation as a string</DL>
</DD>
</DL>
<HR>
<A NAME="asHex(byte[], java.lang.String)"><!-- --></A><H3>
asHex</H3>
<PRE>
public static java.lang.String <B>asHex</B>(byte[]&nbsp;bytes,
java.lang.String&nbsp;separator)</PRE>
<DL>
<DD>Returns a hexadecimal representation of the given byte array.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>bytes</CODE> - the array to output to an hex string<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.
<DT><B>Returns:</B><DD>the hex representation as a string</DL>
</DD>
</DL>
<HR>
<A NAME="asByteArray(java.lang.String)"><!-- --></A><H3>
asByteArray</H3>
<PRE>
public static byte[] <B>asByteArray</B>(java.lang.String&nbsp;hex)</PRE>
<DL>
<DD>Converts a hex string representation to a byte array.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>hex</CODE> - the string holding the hex values
<DT><B>Returns:</B><DD>the resulting byte array</DL>
</DD>
</DL>
<HR>
<A NAME="makeIntFromByte4(byte[])"><!-- --></A><H3>
makeIntFromByte4</H3>
<PRE>
public static final int <B>makeIntFromByte4</B>(byte[]&nbsp;b)</PRE>
<DL>
<DD>Reads an int from 4 bytes of the given array at offset 0.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the byte array to read<DD><CODE>offset</CODE> - the offset at which to start
<DT><B>Returns:</B><DD>the int value</DL>
</DD>
</DL>
<HR>
<A NAME="makeIntFromByte4(byte[], int)"><!-- --></A><H3>
makeIntFromByte4</H3>
<PRE>
public static final int <B>makeIntFromByte4</B>(byte[]&nbsp;b,
int&nbsp;offset)</PRE>
<DL>
<DD>Reads an int from 4 bytes of the given array at the given offset.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the byte array to read<DD><CODE>offset</CODE> - the offset at which to start
<DT><B>Returns:</B><DD>the int value</DL>
</DD>
</DL>
<HR>
<A NAME="makeIntFromByte2(byte[])"><!-- --></A><H3>
makeIntFromByte2</H3>
<PRE>
public static final int <B>makeIntFromByte2</B>(byte[]&nbsp;b)</PRE>
<DL>
<DD>Reads an int from 2 bytes of the given array at offset 0.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the byte array to read
<DT><B>Returns:</B><DD>the int value</DL>
</DD>
</DL>
<HR>
<A NAME="makeIntFromByte2(byte[], int)"><!-- --></A><H3>
makeIntFromByte2</H3>
<PRE>
public static final int <B>makeIntFromByte2</B>(byte[]&nbsp;b,
int&nbsp;offset)</PRE>
<DL>
<DD>Reads an int from 2 bytes of the given array at the given offset.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the byte array to read<DD><CODE>offset</CODE> - the offset at which to start
<DT><B>Returns:</B><DD>the int value</DL>
</DD>
</DL>
<HR>
<A NAME="isFlagSet(int, int)"><!-- --></A><H3>
isFlagSet</H3>
<PRE>
public static final boolean <B>isFlagSet</B>(int&nbsp;flagSet,
int&nbsp;testFlag)</PRE>
<DL>
<DD>Returns true if the flag <code>testFlag</code> is set in the
<code>flags</code> flagset.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>flagset</CODE> - the flagset to test<DD><CODE>testFlag</CODE> - the flag we search the presence of
<DT><B>Returns:</B><DD>true if testFlag is present in the flagset, false otherwise.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ByteUtilities.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../../../org/apache/mina/proxy/utils/IoBufferDecoder.html" title="class in org.apache.mina.proxy.utils"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/mina/proxy/utils/ByteUtilities.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="ByteUtilities.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright &#169; 2004-2011 <a href="http://mina.apache.org/">Apache MINA Project</a>. All Rights Reserved.
</BODY>
</HTML>