edu.ucf.cs.courses.cop4610l.beans.streams
Class StreamToString

java.lang.Object
  |
  +--edu.ucf.cs.courses.cop4610l.beans.streams.StreamToString
All Implemented Interfaces:
java.io.Serializable

public class StreamToString
extends java.lang.Object
implements java.io.Serializable

A JavaBean that puts the contents of a InputStream into a String object. It takes as an argument a stream and returns (via an event) a string.

See Also:
Serialized Form

Field Summary
private  java.util.Set listeners
          Listeners of StringConstructedEvents.
private  java.lang.String string
          The string created from the input stream.
 
Constructor Summary
StreamToString()
           
 
Method Summary
 void addStringConstructedListener(StringConstructedListener listener)
          This bean currently can only support one listener.
 void constructString(java.io.InputStream in)
          Puts the contents of in into a String.
private  void fireStringConstructed(StringConstructedEvent e)
           
 java.lang.String getString()
          There is only a getter method for this property since it is read-only.
 void removeStringConstructedListener(StringConstructedListener listener)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

listeners

private java.util.Set listeners
Listeners of StringConstructedEvents.

string

private java.lang.String string
The string created from the input stream.
Constructor Detail

StreamToString

public StreamToString()
Method Detail

getString

public java.lang.String getString()
There is only a getter method for this property since it is read-only. It should be called only after hearing a StringConstructedEvent.
Returns:
the newly constructed string

addStringConstructedListener

public void addStringConstructedListener(StringConstructedListener listener)
                                  throws java.util.TooManyListenersException
This bean currently can only support one listener.
Parameters:
listener -  
Throws:
java.util.TooManyListenersException - if more than one listener attempts to add

removeStringConstructedListener

public void removeStringConstructedListener(StringConstructedListener listener)

fireStringConstructed

private void fireStringConstructed(StringConstructedEvent e)

constructString

public void constructString(java.io.InputStream in)
Puts the contents of in into a String. A StringConstructedEvent is fired when done.
Parameters:
in - the input stream whose contents will be put in a string