Package org.igniterealtime.jbosh
Class StaticBody
java.lang.Object
org.igniterealtime.jbosh.AbstractBody
org.igniterealtime.jbosh.StaticBody
Implementation of the
AbstractBody
class which allows for the
definition of messages from pre-existing message content. Instances of
this class are based on the underlying data and therefore cannot be
modified. In order to obtain the wrapper element namespace and
attribute information, the body content is partially parsed.
This class does only minimal syntactic and semantic checking with respect
to what the generated XML will look like. It is up to the developer to
protect against the definition of malformed XML messages when building
instances of this class.
Instances of this class are immutable and thread-safe.-
Field Summary
FieldsModifier and TypeFieldDescriptionMap of all attributes to their values.private static final int
Size of the internal buffer when copying from a stream.private static final BodyParser
Selected parser to be used to process raw XML messages.private final String
This body message in raw XML form. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
StaticBody
(Map<BodyQName, String> attrMap, String rawXML) Prevent direct construction. -
Method Summary
Modifier and TypeMethodDescriptionstatic StaticBody
fromStream
(InputStream inStream) Creates an instance which is initialized by reading a body message from the provided stream.static StaticBody
fromString
(String rawXML) Creates an instance which is initialized by reading a body message from the provided raw XML string.Get a map of all defined attribute names with their corresponding values.toXML()
Get an XML String representation of this message.Methods inherited from class org.igniterealtime.jbosh.AbstractBody
getAttribute, getAttributeNames, getBodyQName
-
Field Details
-
PARSER
Selected parser to be used to process raw XML messages. -
BUFFER_SIZE
private static final int BUFFER_SIZESize of the internal buffer when copying from a stream.- See Also:
-
attrs
Map of all attributes to their values. -
raw
This body message in raw XML form.
-
-
Constructor Details
-
StaticBody
Prevent direct construction.
-
-
Method Details
-
fromStream
Creates an instance which is initialized by reading a body message from the provided stream.- Parameters:
inStream
- stream to read message XML from- Returns:
- body instance
- Throws:
BOSHException
- on parse error
-
fromString
Creates an instance which is initialized by reading a body message from the provided raw XML string.- Parameters:
rawXML
- raw message XML in string form- Returns:
- body instance
- Throws:
BOSHException
- on parse error
-
getAttributes
Get a map of all defined attribute names with their corresponding values.- Specified by:
getAttributes
in classAbstractBody
- Returns:
- map of qualified attributes
-
toXML
Get an XML String representation of this message.- Specified by:
toXML
in classAbstractBody
- Returns:
- XML string representing the body message
-