| <!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> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
| <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ByteUtilities.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
| </TR> |
| </TABLE> |
| </TD> |
| <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
| </EM> |
| </TD> |
| </TR> |
| |
| <TR> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| PREV CLASS |
| <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> |
| <A HREF="ByteUtilities.html" target="_top"><B>NO FRAMES</B></A> |
| <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: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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> |
| </TD> |
| </TR> |
| </TABLE> |
| |
| <!-- ========== 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 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 hex)</CODE> |
| |
| <BR> |
| 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 java.lang.String</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#asHex(byte[])">asHex</A></B>(byte[] bytes)</CODE> |
| |
| <BR> |
| 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 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[] bytes, |
| java.lang.String separator)</CODE> |
| |
| <BR> |
| 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 void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#changeByteEndianess(byte[], int, int)">changeByteEndianess</A></B>(byte[] b, |
| int offset, |
| int length)</CODE> |
| |
| <BR> |
| 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 void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#changeWordEndianess(byte[], int, int)">changeWordEndianess</A></B>(byte[] b, |
| int offset, |
| int length)</CODE> |
| |
| <BR> |
| 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 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 s, |
| boolean useUnicode)</CODE> |
| |
| <BR> |
| 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 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 s)</CODE> |
| |
| <BR> |
| 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 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 s)</CODE> |
| |
| <BR> |
| 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 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 num, |
| byte[] buf, |
| int start, |
| int count)</CODE> |
| |
| <BR> |
| 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 byte[]</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#intToNetworkByteOrder(int, int)">intToNetworkByteOrder</A></B>(int num, |
| int count)</CODE> |
| |
| <BR> |
| 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 boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#isFlagSet(int, int)">isFlagSet</A></B>(int flagSet, |
| int testFlag)</CODE> |
| |
| <BR> |
| 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 int</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte2(byte[])">makeIntFromByte2</A></B>(byte[] b)</CODE> |
| |
| <BR> |
| 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 int</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte2(byte[], int)">makeIntFromByte2</A></B>(byte[] b, |
| int offset)</CODE> |
| |
| <BR> |
| 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 int</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte4(byte[])">makeIntFromByte4</A></B>(byte[] b)</CODE> |
| |
| <BR> |
| 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 int</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#makeIntFromByte4(byte[], int)">makeIntFromByte4</A></B>(byte[] b, |
| int offset)</CODE> |
| |
| <BR> |
| 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 int</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#networkByteOrderToInt(byte[], int, int)">networkByteOrderToInt</A></B>(byte[] buf, |
| int start, |
| int count)</CODE> |
| |
| <BR> |
| 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 byte[]</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeInt(int)">writeInt</A></B>(int v)</CODE> |
| |
| <BR> |
| 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 byte[]</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeInt(int, byte[], int)">writeInt</A></B>(int v, |
| byte[] b, |
| int offset)</CODE> |
| |
| <BR> |
| 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 byte[]</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeShort(short)">writeShort</A></B>(short v)</CODE> |
| |
| <BR> |
| 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 byte[]</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../../../../org/apache/mina/proxy/utils/ByteUtilities.html#writeShort(short, byte[], int)">writeShort</A></B>(short v, |
| byte[] b, |
| int offset)</CODE> |
| |
| <BR> |
| Write a 16 bit short as LITTLE_ENDIAN to |
| the given array <code>b</code> at offset <code>offset</code>.</TD> |
| </TR> |
| </TABLE> |
| <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> |
| |
| <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[] buf, |
| int start, |
| int 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 num, |
| int 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 num, |
| byte[] buf, |
| int start, |
| int 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 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 v, |
| byte[] b, |
| int 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 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 v, |
| byte[] b, |
| int 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[] b, |
| int offset, |
| int 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[] b, |
| int offset, |
| int 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 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 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 s, |
| boolean 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[] 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[] bytes, |
| java.lang.String 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 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[] 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[] b, |
| int 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[] 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[] b, |
| int 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 flagSet, |
| int 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> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
| <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ByteUtilities.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
| </TR> |
| </TABLE> |
| </TD> |
| <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
| </EM> |
| </TD> |
| </TR> |
| |
| <TR> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| PREV CLASS |
| <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> |
| <A HREF="ByteUtilities.html" target="_top"><B>NO FRAMES</B></A> |
| <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: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> |
| </TR> |
| </TABLE> |
| <A NAME="skip-navbar_bottom"></A> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| |
| <HR> |
| Copyright © 2004-2011 <a href="http://mina.apache.org/">Apache MINA Project</a>. All Rights Reserved. |
| </BODY> |
| </HTML> |