thinkmap.datasource.stream
Interface IStreamFactory

All Known Implementing Classes:
DataSourceContext.ServletStreamFactory, RemoteDataSource.URLStreamFactory

public interface IStreamFactory

The IStreamFactory interface should be implemented by classes that wish to change the transport mechanism used by a RemoteDataSource.

It's openStream() method is called by the StreamWriter when each new message that is being sent by the StreamWriter begins. When the message ends, the StreamWriter calls the closeStream() method. the StreamFactory should then close the stream that it opened in the openStream method. The IStreamFactory should aquire this stream by calling the getStream() method on the StreamWriter rather than storing the stream locally. This ensures that if the StreamWriter wrapped the stream with another stream, that the stream will be flushed and closed normally.

Version:
$Revision: 1.2 $

Method Summary
 void closeStream(StreamWriter sw)
          Close an output stream for a StreamWriter.
 OutputStream openStream(StreamWriter sw)
          Open an output stream for a StreamWriter.
 

Method Detail

openStream

OutputStream openStream(StreamWriter sw)
                        throws IOException
Open an output stream for a StreamWriter.

Parameters:
sw - the StreamWriter who is calling this method
Returns:
an output stream for the StreamWriter to write to
Throws:
IOException

closeStream

void closeStream(StreamWriter sw)
Close an output stream for a StreamWriter.

Parameters:
sw - the StreamWriter who is calling this method


Copyright © 2013 Thinkmap, Inc. All Rights Reserved.