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

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

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

A JavaBean that puts the contents of a String into a InputStream. It takes as an argument a string and returns (via an event) a stream that can be consumed by other objects.

See Also:
Serialized Form

Field Summary
private  java.util.Set listeners
           
private  java.io.InputStream stream
           
 
Constructor Summary
StringToStream()
           
 
Method Summary
 void addStreamConstructedListener(StreamConstructedListener listener)
          This bean currently can only support one listener.
 void constructStream(java.lang.String s)
          Puts the contents of s into an InputStream for consumption by another object.
private  void fireStreamConstructed(StreamConstructedEvent e)
           
 java.io.InputStream getStream()
          There is only a getter method for this property since it is read-only.
 void removeStreamConstructedListener(StreamConstructedListener 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

stream

private java.io.InputStream stream
Constructor Detail

StringToStream

public StringToStream()
Method Detail

getStream

public java.io.InputStream getStream()
There is only a getter method for this property since it is read-only. It should be called only after hearing a StreamConstructedEvent.
Returns:
the newly constructed stream

addStreamConstructedListener

public void addStreamConstructedListener(StreamConstructedListener 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

removeStreamConstructedListener

public void removeStreamConstructedListener(StreamConstructedListener listener)

fireStreamConstructed

private void fireStreamConstructed(StreamConstructedEvent e)

constructStream

public void constructStream(java.lang.String s)
Puts the contents of s into an InputStream for consumption by another object.
Parameters:
s - the string produced from the contents of the stream