edu.isi.pegasus.planner.provenance.pasoa.producer
Class InMemory

java.lang.Object
  extended by edu.isi.pegasus.planner.provenance.pasoa.producer.InMemory
All Implemented Interfaces:
XMLProducer

public class InMemory
extends 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: 2561 $
Author:
Karan Vahi

Field Summary
private  int mSize
          The initial size of the buffer.
private  StringBuffer mStore
          The StringBuffer store.
 
Constructor Summary
InMemory()
          The default constructor.
InMemory(int size)
          The overloaded constructor.
 
Method Summary
 void add(String xml)
          Adds to the internal XML representation.
 void clear()
          Clears the internal state.
private  void reset()
          Resets the internal store.
 String toXML()
          Returns the interaction assertions as a XML blob.
 void toXML(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 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(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(Writer writer)
           throws 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:
IOException - if something fishy happens to the stream.

toXML

public String toXML()
             throws IOException
Returns the interaction assertions as a XML blob.

Specified by:
toXML in interface XMLProducer
Returns:
String
Throws:
IOException - if something fishy happens to the stream.

reset

private void reset()
Resets the internal store.



Copyright © 2011 The University of Southern California. All Rights Reserved.