📄 roster.html
字号:
<!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.5.0_07) on Thu Jun 21 14:48:18 PDT 2007 --><TITLE>Roster (Smack 3.0.4 Documentation)</TITLE><META NAME="keywords" CONTENT="org.jivesoftware.smack.Roster class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="Roster (Smack 3.0.4 Documentation)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= 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><b>Smack</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../org/jivesoftware/smack/ReconnectionManager.html" title="class in org.jivesoftware.smack"><B>PREV CLASS</B></A> <A HREF="../../../org/jivesoftware/smack/Roster.SubscriptionMode.html" title="enum in org.jivesoftware.smack"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?org/jivesoftware/smack/Roster.html" target="_top"><B>FRAMES</B></A> <A HREF="Roster.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: <A HREF="#nested_class_summary">NESTED</A> | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <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.jivesoftware.smack</FONT><BR>Class Roster</H2><PRE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A> <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>org.jivesoftware.smack.Roster</B></PRE><HR><DL><DT><PRE>public class <B>Roster</B><DT>extends <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></DL></PRE><P>Represents a user's roster, which is the collection of users a person receives presence updates for. Roster items are categorized into groups for easier management.<p> <p/> Others users may attempt to subscribe to this user using a subscription request. Three modes are supported for handling these requests: <ul> <li><A HREF="../../../org/jivesoftware/smack/Roster.SubscriptionMode.html#accept_all"><CODE>accept_all</CODE></A> -- accept all subscription requests.</li> <li><A HREF="../../../org/jivesoftware/smack/Roster.SubscriptionMode.html#reject_all"><CODE>reject_all</CODE></A> -- reject all subscription requests.</li> <li><A HREF="../../../org/jivesoftware/smack/Roster.SubscriptionMode.html#manual"><CODE>manual</CODE></A> -- manually process all subscription requests.</li> </ul><P><P><DL><DT><B>Author:</B></DT> <DD>Matt Tucker</DD><DT><B>See Also:</B><DD><A HREF="../../../org/jivesoftware/smack/XMPPConnection.html#getRoster()"><CODE>XMPPConnection.getRoster()</CODE></A></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><A NAME="nested_class_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>Nested Class Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static class</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/smack/Roster.SubscriptionMode.html" title="enum in org.jivesoftware.smack">Roster.SubscriptionMode</A></B></CODE><BR> An enumeration for the subscription mode options.</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> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/smack/Roster.html#addRosterListener(org.jivesoftware.smack.RosterListener)">addRosterListener</A></B>(<A HREF="../../../org/jivesoftware/smack/RosterListener.html" title="interface in org.jivesoftware.smack">RosterListener</A> rosterListener)</CODE><BR> Adds a listener to this roster.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/smack/Roster.html#contains(java.lang.String)">contains</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> user)</CODE><BR> Returns true if the specified XMPP address is an entry in the roster.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/smack/Roster.html#createEntry(java.lang.String, java.lang.String, java.lang.String[])">createEntry</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> user, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>[] groups)</CODE><BR> Creates a new roster entry and presence subscription.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../org/jivesoftware/smack/RosterGroup.html" title="class in org.jivesoftware.smack">RosterGroup</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/smack/Roster.html#createGroup(java.lang.String)">createGroup</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> name)</CODE><BR> Creates a new group.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../../org/jivesoftware/smack/Roster.SubscriptionMode.html" title="enum in org.jivesoftware.smack">Roster.SubscriptionMode</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/smack/Roster.html#getDefaultSubscriptionMode()">getDefaultSubscriptionMode</A></B>()</CODE><BR> Returns the default subscription processing mode to use when a new Roster is created.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Collection.html" title="class or interface in java.util">Collection</A><<A HREF="../../../org/jivesoftware/smack/RosterEntry.html" title="class in org.jivesoftware.smack">RosterEntry</A>></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/smack/Roster.html#getEntries()">getEntries</A></B>()</CODE><BR> Returns an unmodifiable collection of all entries in the roster, including entries that don't belong to any groups.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../org/jivesoftware/smack/RosterEntry.html" title="class in org.jivesoftware.smack">RosterEntry</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/smack/Roster.html#getEntry(java.lang.String)">getEntry</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> user)</CODE><BR> Returns the roster entry associated with the given XMPP address or <tt>null</tt> if the user is not an entry in the roster.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/smack/Roster.html#getEntryCount()">getEntryCount</A></B>()</CODE><BR> Returns a count of the entries in the roster.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../org/jivesoftware/smack/RosterGroup.html" title="class in org.jivesoftware.smack">RosterGroup</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/smack/Roster.html#getGroup(java.lang.String)">getGroup</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> name)</CODE><BR> Returns the roster group with the specified name, or <tt>null</tt> if the group doesn't exist.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/smack/Roster.html#getGroupCount()">getGroupCount</A></B>()</CODE><BR> Returns the number of the groups in the roster.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Collection.html" title="class or interface in java.util">Collection</A><<A HREF="../../../org/jivesoftware/smack/RosterGroup.html" title="class in org.jivesoftware.smack">RosterGroup</A>></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/smack/Roster.html#getGroups()">getGroups</A></B>()</CODE><BR> Returns an unmodiable collections of all the roster groups.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../org/jivesoftware/smack/packet/Presence.html" title="class in org.jivesoftware.smack.packet">Presence</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/smack/Roster.html#getPresence(java.lang.String)">getPresence</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> user)</CODE><BR> Returns the presence info for a particular user.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../org/jivesoftware/smack/packet/Presence.html" title="class in org.jivesoftware.smack.packet">Presence</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/smack/Roster.html#getPresenceResource(java.lang.String)">getPresenceResource</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> userWithResource)</CODE><BR> Returns the presence info for a particular user's resource, or unavailable presence if the user is offline or if no presence information is available, such as when you are not subscribed to the user's presence updates.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Iterator.html" title="class or interface in java.util">Iterator</A><<A HREF="../../../org/jivesoftware/smack/packet/Presence.html" title="class in org.jivesoftware.smack.packet">Presence</A>></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/smack/Roster.html#getPresences(java.lang.String)">getPresences</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> user)</CODE><BR> Returns an iterator (of Presence objects) for all of a user's current presences or an unavailable presence if the user is unavailable (offline) or if no presence information is available, such as when you are not subscribed to the user's presence
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -