📄 stringutils.html
字号:
<BR> Returns the name portion of a XMPP address.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/StringUtils.html#parseResource(java.lang.String)">parseResource</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> XMPPAddress)</CODE><BR> Returns the resource portion of a XMPP address.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/StringUtils.html#parseServer(java.lang.String)">parseServer</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> XMPPAddress)</CODE><BR> Returns the server portion of a XMPP address.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/StringUtils.html#randomString(int)">randomString</A></B>(int length)</CODE><BR> Returns a random String of numbers and letters (lower and upper case) of the specified length.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/StringUtils.html#unescapeNode(java.lang.String)">unescapeNode</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> node)</CODE><BR> Un-escapes the node portion of a JID according to "JID Escaping" (JEP-0106).</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.<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD></TR></TABLE> <P><!-- ============ 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="parseName(java.lang.String)"><!-- --></A><H3>parseName</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>parseName</B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> XMPPAddress)</PRE><DL><DD>Returns the name portion of a XMPP address. For example, for the address "matt@jivesoftware.com/Smack", "matt" would be returned. If no username is present in the address, the empty string will be returned.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>XMPPAddress</CODE> - the XMPP address.<DT><B>Returns:</B><DD>the name portion of the XMPP address.</DL></DD></DL><HR><A NAME="parseServer(java.lang.String)"><!-- --></A><H3>parseServer</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>parseServer</B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> XMPPAddress)</PRE><DL><DD>Returns the server portion of a XMPP address. For example, for the address "matt@jivesoftware.com/Smack", "jivesoftware.com" would be returned. If no server is present in the address, the empty string will be returned.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>XMPPAddress</CODE> - the XMPP address.<DT><B>Returns:</B><DD>the server portion of the XMPP address.</DL></DD></DL><HR><A NAME="parseResource(java.lang.String)"><!-- --></A><H3>parseResource</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>parseResource</B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> XMPPAddress)</PRE><DL><DD>Returns the resource portion of a XMPP address. For example, for the address "matt@jivesoftware.com/Smack", "Smack" would be returned. If no resource is present in the address, the empty string will be returned.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>XMPPAddress</CODE> - the XMPP address.<DT><B>Returns:</B><DD>the resource portion of the XMPP address.</DL></DD></DL><HR><A NAME="parseBareAddress(java.lang.String)"><!-- --></A><H3>parseBareAddress</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>parseBareAddress</B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> XMPPAddress)</PRE><DL><DD>Returns the XMPP address with any resource information removed. For example, for the address "matt@jivesoftware.com/Smack", "matt@jivesoftware.com" would be returned.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>XMPPAddress</CODE> - the XMPP address.<DT><B>Returns:</B><DD>the bare XMPP address without resource information.</DL></DD></DL><HR><A NAME="escapeNode(java.lang.String)"><!-- --></A><H3>escapeNode</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>escapeNode</B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> node)</PRE><DL><DD>Escapes the node portion of a JID according to "JID Escaping" (JEP-0106). Escaping replaces characters prohibited by node-prep with escape sequences, as follows:<p> <table border="1"> <tr><td><b>Unescaped Character</b></td><td><b>Encoded Sequence</b></td></tr> <tr><td><space></td><td>\20</td></tr> <tr><td>"</td><td>\22</td></tr> <tr><td>&</td><td>\26</td></tr> <tr><td>'</td><td>\27</td></tr> <tr><td>/</td><td>\2f</td></tr> <tr><td>:</td><td>\3a</td></tr> <tr><td><</td><td>\3c</td></tr> <tr><td>></td><td>\3e</td></tr> <tr><td>@</td><td>\40</td></tr> <tr><td>\</td><td>\5c</td></tr> </table><p> This process is useful when the node comes from an external source that doesn't conform to nodeprep. For example, a username in LDAP may be "Joe Smith". Because the <space> character isn't a valid part of a node, the username should be escaped to "Joe\20Smith" before being made into a JID (e.g. "joe\20smith@example.com" after case-folding, etc. has been applied).<p> All node escaping and un-escaping must be performed manually at the appropriate time; the JID class will not escape or un-escape automatically.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>node</CODE> - the node.<DT><B>Returns:</B><DD>the escaped version of the node.</DL></DD></DL><HR><A NAME="unescapeNode(java.lang.String)"><!-- --></A><H3>unescapeNode</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>unescapeNode</B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> node)</PRE><DL><DD>Un-escapes the node portion of a JID according to "JID Escaping" (JEP-0106).<p> Escaping replaces characters prohibited by node-prep with escape sequences, as follows:<p> <table border="1"> <tr><td><b>Unescaped Character</b></td><td><b>Encoded Sequence</b></td></tr> <tr><td><space></td><td>\20</td></tr> <tr><td>"</td><td>\22</td></tr> <tr><td>&</td><td>\26</td></tr> <tr><td>'</td><td>\27</td></tr> <tr><td>/</td><td>\2f</td></tr> <tr><td>:</td><td>\3a</td></tr> <tr><td><</td><td>\3c</td></tr> <tr><td>></td><td>\3e</td></tr> <tr><td>@</td><td>\40</td></tr> <tr><td>\</td><td>\5c</td></tr> </table><p> This process is useful when the node comes from an external source that doesn't conform to nodeprep. For example, a username in LDAP may be "Joe Smith". Because the <space> character isn't a valid part of a node, the username should be escaped to "Joe\20Smith" before being made into a JID (e.g. "joe\20smith@example.com" after case-folding, etc. has been applied).<p> All node escaping and un-escaping must be performed manually at the appropriate time; the JID class will not escape or un-escape automatically.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>node</CODE> - the escaped version of the node.<DT><B>Returns:</B><DD>the un-escaped version of the node.</DL></DD></DL><HR><A NAME="escapeForXML(java.lang.String)"><!-- --></A><H3>escapeForXML</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>escapeForXML</B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> string)</PRE><DL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -