com.monica.javacom.streams
Class MJCReaderHasAOS

java.lang.Object
  |
  +--com.monica.javacom.streams.MJCReaderHasAOS
All Implemented Interfaces:
MJCReader

public class MJCReaderHasAOS
extends java.lang.Object
implements MJCReader

Class for creating a link between an OutputStream and the MJC layer hierarchy. This class acts as a MJCReader, this means it handles asynchronous readEvents from an MJCReadable, and what it reads, it forwards to an OuputStream. The writing to the OuputStream is not buffered.


Constructor Summary
MJCReaderHasAOS(java.io.OutputStream os)
          Constructor.
 
Method Summary
 void connectionClosedEvent(MJCReadable readable)
          Handles the asynchronous connectionClosedEvents from the MJCReadable.
 void errorEvent(java.lang.String errorDescription, MJCReadable readable)
          Handles the asynchronous errorEvent from the MJCReadable.
 MJCReadable getReadable()
          Queries the MJCReadable from which data will be read.
 java.lang.String getReaderName()
          Returns the MJC name of the MJCReader.
 java.lang.String getReaderVersion()
          Returns the MJC version of the MJCReader.
 void readEvent(MJCReadable readable)
          Handles the asynchronous readEvents from the MJCReadable.
 void setReadable(MJCReadable readable)
          Sets the MJCReadable from which data has to be read, this means, which will send the readEvents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MJCReaderHasAOS

public MJCReaderHasAOS(java.io.OutputStream os)
Constructor. The OutputStream has to be specified.
Parameters:
OutputStream - os: the OutputStream to which data has to be forwarded
Method Detail

getReaderName

public java.lang.String getReaderName()
Returns the MJC name of the MJCReader.
Specified by:
getReaderName in interface MJCReader
Returns:
String: the MJC name of the MJCReader

getReaderVersion

public java.lang.String getReaderVersion()
Returns the MJC version of the MJCReader.
Specified by:
getReaderVersion in interface MJCReader
Returns:
String: the MJC version of the MJCReader

readEvent

public void readEvent(MJCReadable readable)
Handles the asynchronous readEvents from the MJCReadable. Data read from the MJCReadable will be written on the OutputStream.
Specified by:
readEvent in interface MJCReader
Parameters:
MJCReadable - readable: the MJCReadable from which the readEvent came

connectionClosedEvent

public void connectionClosedEvent(MJCReadable readable)
Handles the asynchronous connectionClosedEvents from the MJCReadable. The OutputStream will be closed.
Specified by:
connectionClosedEvent in interface MJCReader
Parameters:
MJCReadable - readable: the MJCReadable where the connectionClosedEvent occured

errorEvent

public void errorEvent(java.lang.String errorDescription,
                       MJCReadable readable)
Handles the asynchronous errorEvent from the MJCReadable. The OutputStream will be closed.
Specified by:
errorEvent in interface MJCReader
Parameters:
String - errorDescription: the error message
MJCReadable - readable: the MJCReadable where the error occured

setReadable

public void setReadable(MJCReadable readable)
Sets the MJCReadable from which data has to be read, this means, which will send the readEvents.
Specified by:
setReadable in interface MJCReader
Parameters:
MJCReadable - readable: the MJCReadable from which data has to be read

getReadable

public MJCReadable getReadable()
Queries the MJCReadable from which data will be read.
Specified by:
getReadable in interface MJCReader
Returns:
MJCReadable: the MJCReadable from which data will be read