<!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_17) on Sun Mar 14 17:34:28 UTC 2010 --> <TITLE> UtfOps </TITLE> <META NAME="date" CONTENT="2010-03-14"> <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="UtfOps"; } } </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="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"> <A HREF="../../../com/sleepycat/util/RuntimeExceptionWrapper.html" title="class in com.sleepycat.util"><B>PREV CLASS</B></A> NEXT CLASS</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?com/sleepycat/util/UtfOps.html" target="_top"><B>FRAMES</B></A> <A HREF="UtfOps.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"> com.sleepycat.util</FONT> <BR> Class UtfOps</H2> <PRE> java.lang.Object <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.sleepycat.util.UtfOps</B> </PRE> <HR> <DL> <DT><PRE>public class <B>UtfOps</B><DT>extends java.lang.Object</DL> </PRE> <P> UTF operations with more flexibility than is provided by DataInput and DataOutput. <P> <P> <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="../../../com/sleepycat/util/UtfOps.html#UtfOps()">UtfOps</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 int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/util/UtfOps.html#bytesToChars(byte[], int, char[], int, int, boolean)">bytesToChars</A></B>(byte[] bytes, int byteOffset, char[] chars, int charOffset, int len, boolean isByteLen)</CODE> <BR> Converts byte arrays into character arrays.</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="../../../com/sleepycat/util/UtfOps.html#bytesToString(byte[], int, int)">bytesToString</A></B>(byte[] bytes, int offset, int length)</CODE> <BR> Converts byte arrays into strings.</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="../../../com/sleepycat/util/UtfOps.html#charsToBytes(char[], int, byte[], int, int)">charsToBytes</A></B>(char[] chars, int charOffset, byte[] bytes, int byteOffset, int charLength)</CODE> <BR> Converts character arrays into byte arrays.</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="../../../com/sleepycat/util/UtfOps.html#getByteLength(char[])">getByteLength</A></B>(char[] chars)</CODE> <BR> Returns the byte length of the UTF string that would be created by converting the given characters to UTF.</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="../../../com/sleepycat/util/UtfOps.html#getByteLength(char[], int, int)">getByteLength</A></B>(char[] chars, int offset, int length)</CODE> <BR> Returns the byte length of the UTF string that would be created by converting the given characters to UTF.</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="../../../com/sleepycat/util/UtfOps.html#getCharLength(byte[])">getCharLength</A></B>(byte[] bytes)</CODE> <BR> Returns the number of characters represented by the given UTF string.</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="../../../com/sleepycat/util/UtfOps.html#getCharLength(byte[], int, int)">getCharLength</A></B>(byte[] bytes, int offset, int length)</CODE> <BR> Returns the number of characters represented by the given UTF string.</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="../../../com/sleepycat/util/UtfOps.html#getZeroTerminatedByteLength(byte[], int)">getZeroTerminatedByteLength</A></B>(byte[] bytes, int offset)</CODE> <BR> Returns the byte length of a null terminated UTF string, not including the terminator.</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="../../../com/sleepycat/util/UtfOps.html#stringToBytes(java.lang.String)">stringToBytes</A></B>(java.lang.String string)</CODE> <BR> Converts strings to byte arrays.</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="UtfOps()"><!-- --></A><H3> UtfOps</H3> <PRE> public <B>UtfOps</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="getZeroTerminatedByteLength(byte[], int)"><!-- --></A><H3> getZeroTerminatedByteLength</H3> <PRE> public static int <B>getZeroTerminatedByteLength</B>(byte[] bytes, int offset) throws java.lang.IndexOutOfBoundsException</PRE> <DL> <DD>Returns the byte length of a null terminated UTF string, not including the terminator. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>bytes</CODE> - the data containing the UTF string.<DD><CODE>offset</CODE> - the beginning of the string the measure. <DT><B>Returns:</B><DD>the number of bytes. <DT><B>Throws:</B> <DD><CODE>java.lang.IndexOutOfBoundsException</CODE> - if no zero terminator is found.</DL> </DD> </DL> <HR> <A NAME="getByteLength(char[])"><!-- --></A><H3> getByteLength</H3> <PRE> public static int <B>getByteLength</B>(char[] chars)</PRE> <DL> <DD>Returns the byte length of the UTF string that would be created by converting the given characters to UTF. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>chars</CODE> - the characters that would be converted. <DT><B>Returns:</B><DD>the byte length of the equivalent UTF data.</DL> </DD> </DL> <HR> <A NAME="getByteLength(char[], int, int)"><!-- --></A><H3> getByteLength</H3> <PRE> public static int <B>getByteLength</B>(char[] chars, int offset, int length)</PRE> <DL> <DD>Returns the byte length of the UTF string that would be created by converting the given characters to UTF. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>chars</CODE> - the characters that would be converted.<DD><CODE>offset</CODE> - the first character to be converted.<DD><CODE>length</CODE> - the number of characters to be converted. <DT><B>Returns:</B><DD>the byte length of the equivalent UTF data.</DL> </DD> </DL> <HR> <A NAME="getCharLength(byte[])"><!-- --></A><H3> getCharLength</H3> <PRE> public static int <B>getCharLength</B>(byte[] bytes) throws java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException</PRE> <DL> <DD>Returns the number of characters represented by the given UTF string. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>bytes</CODE> - the UTF string. <DT><B>Returns:</B><DD>the number of characters. <DT><B>Throws:</B> <DD><CODE>java.lang.IndexOutOfBoundsException</CODE> - if a UTF character sequence at the end of the data is not complete. <DD><CODE>java.lang.IllegalArgumentException</CODE> - if an illegal UTF sequence is encountered.</DL> </DD> </DL> <HR> <A NAME="getCharLength(byte[], int, int)"><!-- --></A><H3> getCharLength</H3> <PRE> public static int <B>getCharLength</B>(byte[] bytes, int offset, int length) throws java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException</PRE> <DL> <DD>Returns the number of characters represented by the given UTF string. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>bytes</CODE> - the data containing the UTF string.<DD><CODE>offset</CODE> - the first byte to be converted.<DD><CODE>length</CODE> - the number of byte to be converted. <DT><B>Throws:</B> <DD><CODE>java.lang.IndexOutOfBoundsException</CODE> - if a UTF character sequence at the end of the data is not complete. <DD><CODE>java.lang.IllegalArgumentException</CODE> - if an illegal UTF sequence is encountered.</DL> </DD> </DL> <HR> <A NAME="bytesToChars(byte[], int, char[], int, int, boolean)"><!-- --></A><H3> bytesToChars</H3> <PRE> public static int <B>bytesToChars</B>(byte[] bytes, int byteOffset, char[] chars, int charOffset, int len, boolean isByteLen) throws java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException</PRE> <DL> <DD>Converts byte arrays into character arrays. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>bytes</CODE> - the source byte data to convert<DD><CODE>byteOffset</CODE> - the offset into the byte array at which to start the conversion<DD><CODE>chars</CODE> - the destination array<DD><CODE>charOffset</CODE> - the offset into chars at which to begin the copy<DD><CODE>len</CODE> - the amount of information to copy into chars<DD><CODE>isByteLen</CODE> - if true then len is a measure of bytes, otherwise len is a measure of characters <DT><B>Throws:</B> <DD><CODE>java.lang.IndexOutOfBoundsException</CODE> - if a UTF character sequence at the end of the data is not complete. <DD><CODE>java.lang.IllegalArgumentException</CODE> - if an illegal UTF sequence is encountered.</DL> </DD> </DL> <HR> <A NAME="charsToBytes(char[], int, byte[], int, int)"><!-- --></A><H3> charsToBytes</H3> <PRE> public static void <B>charsToBytes</B>(char[] chars, int charOffset, byte[] bytes, int byteOffset, int charLength)</PRE> <DL> <DD>Converts character arrays into byte arrays. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>chars</CODE> - the source character data to convert<DD><CODE>charOffset</CODE> - the offset into the character array at which to start the conversion<DD><CODE>bytes</CODE> - the destination array<DD><CODE>byteOffset</CODE> - the offset into bytes at which to begin the copy<DD><CODE>charLength</CODE> - the length of characters to copy into bytes</DL> </DD> </DL> <HR> <A NAME="bytesToString(byte[], int, int)"><!-- --></A><H3> bytesToString</H3> <PRE> public static java.lang.String <B>bytesToString</B>(byte[] bytes, int offset, int length) throws java.lang.IllegalArgumentException, java.lang.IndexOutOfBoundsException</PRE> <DL> <DD>Converts byte arrays into strings. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>bytes</CODE> - the source byte data to convert<DD><CODE>offset</CODE> - the offset into the byte array at which to start the conversion<DD><CODE>length</CODE> - the number of bytes to be converted. <DT><B>Returns:</B><DD>the string. <DT><B>Throws:</B> <DD><CODE>java.lang.IndexOutOfBoundsException</CODE> - if a UTF character sequence at the end of the data is not complete. <DD><CODE>java.lang.IllegalArgumentException</CODE> - if an illegal UTF sequence is encountered.</DL> </DD> </DL> <HR> <A NAME="stringToBytes(java.lang.String)"><!-- --></A><H3> stringToBytes</H3> <PRE> public static byte[] <B>stringToBytes</B>(java.lang.String string)</PRE> <DL> <DD>Converts strings to byte arrays. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>string</CODE> - the string to convert. <DT><B>Returns:</B><DD>the UTF byte array.</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="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"> <A HREF="../../../com/sleepycat/util/RuntimeExceptionWrapper.html" title="class in com.sleepycat.util"><B>PREV CLASS</B></A> NEXT CLASS</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?com/sleepycat/util/UtfOps.html" target="_top"><B>FRAMES</B></A> <A HREF="UtfOps.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> </BODY> </HTML>