Package org.jxmpp.jid.parts
Class Resourcepart
- java.lang.Object
-
- org.jxmpp.jid.parts.Part
-
- org.jxmpp.jid.parts.Resourcepart
-
- All Implemented Interfaces:
Serializable
,CharSequence
public class Resourcepart extends Part
A resourcepart of an XMPP address (JID).You can create instances of this class from Strings using
from(String)
.- See Also:
- RFC 6122 ยง 2.4. Resourcepart, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Resourcepart
EMPTY
The empty resource part.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Resourcepart
from(String resource)
Get theResourcepart
representing the input String.static Resourcepart
from(String resource, JxmppContext context)
Get theResourcepart
representing the input String.static Resourcepart
fromOrNull(CharSequence cs)
static Resourcepart
fromOrThrowUnchecked(CharSequence cs)
Likefrom(String)
but does throw an uncheckedIllegalArgumentException
instead of aXmppStringprepException
.-
Methods inherited from class org.jxmpp.jid.parts.Part
assertNotLongerThan1023BytesOrEmpty, charAt, equals, hashCode, intern, length, subSequence, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.CharSequence
chars, codePoints
-
-
-
-
Field Detail
-
EMPTY
public static final Resourcepart EMPTY
The empty resource part.This empty resource part is the part that is represented by the empty String. This is useful in cases where you have a collection of Resourceparts that does not allow
null
values, but you want to deal with the "no resource" case.
-
-
Method Detail
-
fromOrNull
public static Resourcepart fromOrNull(CharSequence cs)
- Parameters:
cs
- the input CharSequence- Returns:
- a Resourcepart or
null
-
fromOrThrowUnchecked
public static Resourcepart fromOrThrowUnchecked(CharSequence cs)
Likefrom(String)
but does throw an uncheckedIllegalArgumentException
instead of aXmppStringprepException
.- Parameters:
cs
- the character sequence which should be transformed to aResourcepart
- Returns:
- the
Resourcepart
if no exception occurs - Throws:
IllegalArgumentException
- if the given input is not a validResourcepart
- Since:
- 0.6.2
- See Also:
from(String)
-
from
public static Resourcepart from(String resource) throws XmppStringprepException
Get theResourcepart
representing the input String.- Parameters:
resource
- the input String.- Returns:
- the resource part.
- Throws:
XmppStringprepException
- if an error occurs.
-
from
public static Resourcepart from(String resource, JxmppContext context) throws XmppStringprepException
Get theResourcepart
representing the input String.- Parameters:
resource
- the input String.context
- the JXMPP context.- Returns:
- the resource part.
- Throws:
XmppStringprepException
- if an error occurs.
-
-