org.media.mn8.protocol.jabber
Class JabberDataBlock

java.lang.Object
  |
  +--org.media.mn8.protocol.jabber.JabberDataBlock
Direct Known Subclasses:
Iq, Login, Message, Presence

public class JabberDataBlock
extends Object

The base class for Jabber datablocks objects in the datablock sub package


Field Summary
protected  Hashtable attributes
          The list of attributes in this tag
protected  Vector childBlocks
          The list of child blocks inside this block
protected  JabberDataBlock parent
          This blocks' parent
protected  StringBuffer textData
          A string representing all the text within the data block
 
Constructor Summary
JabberDataBlock()
          Constructor
JabberDataBlock(JabberDataBlock _parent)
          Constructor
JabberDataBlock(JabberDataBlock _parent, Hashtable _attributes)
          Constructor including an Attribute list
JabberDataBlock(String _tagName, JabberDataBlock _parent, Hashtable _attributes)
          Constructor including an Attribute list
 
Method Summary
protected  void addAttributeToStringBuffer(StringBuffer buffer)
          Method to add all the attributes to a string buffer
 void addChild(JabberDataBlock newData)
          Method to add a child to the list of child blocks
 void addText(String text)
          Method to add some text to the text buffer for this block
protected  void constructReply(JabberDataBlock container)
          Method to construct a reply to this block.
 String getAttribute(String attributeName)
          Method to get an attribute
 byte[] getBytes()
          Method to return the data as a byte stream ready to send over the wire
 Vector getChildBlocks()
          Returns a vector holding all of the children of this block
 JabberDataBlock getParent()
          Method to get the parent of this block
 String getTagEnd()
          Method to return the end of tag string as a string
 String getTagName()
          Method to return the tag name
 String getTagStart()
          Method to return the start of tag string as a string
 String getText()
          Method to get the text element of this block
 void setAttribute(String attributeName, String value)
          Method to set an attribute value
 String toString()
          Method to convert this into a String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

childBlocks

protected Vector childBlocks
The list of child blocks inside this block


textData

protected StringBuffer textData
A string representing all the text within the data block


parent

protected JabberDataBlock parent
This blocks' parent


attributes

protected Hashtable attributes
The list of attributes in this tag

Constructor Detail

JabberDataBlock

public JabberDataBlock()
Constructor


JabberDataBlock

public JabberDataBlock(JabberDataBlock _parent)
Constructor


JabberDataBlock

public JabberDataBlock(JabberDataBlock _parent,
                       Hashtable _attributes)
Constructor including an Attribute list

Parameters:
_parent - The parent of this datablock
_attributes - The list of element attributes

JabberDataBlock

public JabberDataBlock(String _tagName,
                       JabberDataBlock _parent,
                       Hashtable _attributes)
Constructor including an Attribute list

Parameters:
_tagName - The name of the block
_parent - The parent of this datablock
_attributes - The list of element attributes
Method Detail

addChild

public void addChild(JabberDataBlock newData)
Method to add a child to the list of child blocks

Parameters:
newData - The child block to add

addText

public void addText(String text)
Method to add some text to the text buffer for this block

Parameters:
text - The text to add

getParent

public JabberDataBlock getParent()
Method to get the parent of this block

Returns:
This blocks parent

getBytes

public byte[] getBytes()
Method to return the data as a byte stream ready to send over the wire

Returns:
The data to send as a byte array

getText

public String getText()
Method to get the text element of this block

Returns:
The text contained in this block

getAttribute

public String getAttribute(String attributeName)
Method to get an attribute

Parameters:
attributeName - The name of the attribute to get
Returns:
The value of the attribute

setAttribute

public void setAttribute(String attributeName,
                         String value)
Method to set an attribute value

Parameters:
attributeName - The name of the attribute to set
value - The value of the attribute

getChildBlocks

public Vector getChildBlocks()
Returns a vector holding all of the children of this block


toString

public String toString()
Method to convert this into a String

Overrides:
toString in class Object
Returns:
The element as an XML string

addAttributeToStringBuffer

protected void addAttributeToStringBuffer(StringBuffer buffer)
Method to add all the attributes to a string buffer

Parameters:
buffer - The string buffer to which all the attributes will be added

getTagStart

public String getTagStart()
Method to return the start of tag string as a string

Returns:
The start tag string

getTagEnd

public String getTagEnd()
Method to return the end of tag string as a string

Returns:
The end tag string

getTagName

public String getTagName()
Method to return the tag name

Returns:
The tag name

constructReply

protected void constructReply(JabberDataBlock container)
Method to construct a reply to this block. Copies the user ID and sets the correct recipient address.



"Copyright © 2000-2002 Internet Multicasting Services, media.org & noLimits Technologies. All Rights Reserved."