Class InMemory

  • All Implemented Interfaces:
    XMLProducer

    public class InMemory
    extends java.lang.Object
    implements XMLProducer
    An implementation of the XMLProducer interface backed by a StringBuffer. It does not check for any wellformedness of the XML. It is basically a data store.
    Version:
    $Revision$
    Author:
    Karan Vahi
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int mSize
      The initial size of the buffer.
      private java.lang.StringBuffer mStore
      The StringBuffer store.
    • Constructor Summary

      Constructors 
      Constructor Description
      InMemory()
      The default constructor.
      InMemory​(int size)
      The overloaded constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(java.lang.String xml)
      Adds to the internal XML representation.
      void clear()
      Clears the internal state.
      private void reset()
      Resets the internal store.
      java.lang.String toXML()
      Returns the interaction assertions as a XML blob.
      void toXML​(java.io.Writer writer)
      Returns the xml description of the object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mStore

        private java.lang.StringBuffer mStore
        The StringBuffer store.
      • mSize

        private int mSize
        The initial size of the buffer.
    • Constructor Detail

      • InMemory

        public InMemory()
        The default constructor.
      • InMemory

        public InMemory​(int size)
        The overloaded constructor.
        Parameters:
        size - the intial number of characters it can store.
    • Method Detail

      • add

        public void add​(java.lang.String xml)
        Adds to the internal XML representation.
        Specified by:
        add in interface XMLProducer
        Parameters:
        xml - the XML fragment to be added.
      • clear

        public void clear()
        Clears the internal state.
        Specified by:
        clear in interface XMLProducer
      • toXML

        public void toXML​(java.io.Writer writer)
                   throws java.io.IOException
        Returns the xml description of the object.
        Specified by:
        toXML in interface XMLProducer
        Parameters:
        writer - is a Writer opened and ready for writing. This can also be a StringWriter for efficient output.
        Throws:
        java.io.IOException - if something fishy happens to the stream.
      • toXML

        public java.lang.String toXML()
                               throws java.io.IOException
        Returns the interaction assertions as a XML blob.
        Specified by:
        toXML in interface XMLProducer
        Returns:
        String
        Throws:
        java.io.IOException - if something fishy happens to the stream.
      • reset

        private void reset()
        Resets the internal store.