public abstract class Packet
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ID_NOT_AVAILABLE
Constant used as packetID to indicate that a packet has no id.
|
Constructor and Description |
---|
Packet() |
Modifier and Type | Method and Description |
---|---|
void |
addExtension(PacketExtension extension)
Adds a packet extension to the packet.
|
void |
deleteProperty(java.lang.String name)
Deletes a property.
|
XMPPError |
getError()
Returns the error associated with this packet, or null if there are
no errors.
|
PacketExtension |
getExtension(java.lang.String elementName,
java.lang.String namespace)
Returns the first packet extension that matches the specified element name and
namespace, or null if it doesn't exist.
|
java.util.Iterator |
getExtensions()
Returns an Iterator for the packet extensions attached to the packet.
|
protected java.lang.String |
getExtensionsXML()
Returns the extension sub-packets (including properties data) as an XML
String, or the Empty String if there are no packet extensions.
|
java.lang.String |
getFrom()
Returns who the packet is being sent "from" or null if
the value is not set.
|
java.lang.String |
getPacketID()
Returns the unique ID of the packet.
|
java.lang.Object |
getProperty(java.lang.String name)
Returns the packet property with the specified name or null if the
property doesn't exist.
|
java.util.Iterator |
getPropertyNames()
Returns an Iterator for all the property names that are set.
|
java.lang.String |
getTo()
Returns who the packet is being sent "to", or null if
the value is not set.
|
void |
removeExtension(PacketExtension extension)
Removes a packet extension from the packet.
|
void |
setError(XMPPError error)
Sets the error for this packet.
|
void |
setFrom(java.lang.String from)
Sets who the packet is being sent "from".
|
void |
setPacketID(java.lang.String packetID)
Sets the unique ID of the packet.
|
void |
setProperty(java.lang.String name,
boolean value)
Sets a packet property with a bboolean value.
|
void |
setProperty(java.lang.String name,
double value)
Sets a packet property with a double value.
|
void |
setProperty(java.lang.String name,
float value)
Sets a packet property with a float value.
|
void |
setProperty(java.lang.String name,
int value)
Sets a packet property with an int value.
|
void |
setProperty(java.lang.String name,
long value)
Sets a packet property with a long value.
|
void |
setProperty(java.lang.String name,
java.lang.Object value)
Sets a property with an Object as the value.
|
void |
setTo(java.lang.String to)
Sets who the packet is being sent "to".
|
abstract java.lang.String |
toXML()
Returns the packet as XML.
|
public static final java.lang.String ID_NOT_AVAILABLE
public java.lang.String getPacketID()
public void setPacketID(java.lang.String packetID)
packetID
- the unique ID for the packet.public java.lang.String getTo()
public void setTo(java.lang.String to)
to
- who the packet is being sent to.public java.lang.String getFrom()
public void setFrom(java.lang.String from)
from
- who the packet is being sent to.public XMPPError getError()
public void setError(XMPPError error)
error
- the error to associate with this packet.public java.util.Iterator getExtensions()
public PacketExtension getExtension(java.lang.String elementName, java.lang.String namespace)
ProviderManager
class to handle custom parsing. In that case, the type of the Object
will be determined by the provider.elementName
- the XML element name of the packet extension.namespace
- the XML element namespace of the packet extension.public void addExtension(PacketExtension extension)
extension
- a packet extension.public void removeExtension(PacketExtension extension)
extension
- the packet extension to remove.public java.lang.Object getProperty(java.lang.String name)
name
- the name of the property.public void setProperty(java.lang.String name, int value)
name
- the name of the property.value
- the value of the property.public void setProperty(java.lang.String name, long value)
name
- the name of the property.value
- the value of the property.public void setProperty(java.lang.String name, float value)
name
- the name of the property.value
- the value of the property.public void setProperty(java.lang.String name, double value)
name
- the name of the property.value
- the value of the property.public void setProperty(java.lang.String name, boolean value)
name
- the name of the property.value
- the value of the property.public void setProperty(java.lang.String name, java.lang.Object value)
name
- the name of the property.value
- the value of the property.public void deleteProperty(java.lang.String name)
name
- the name of the property to delete.public java.util.Iterator getPropertyNames()
public abstract java.lang.String toXML()
protected java.lang.String getExtensionsXML()
Copyright © 2003 Jive Software.