com.monica.javacom.streams
Class MJCReadableHasAIS

java.lang.Object
  |
  +--com.monica.javacom.streams.MJCReadableHasAIS
All Implemented Interfaces:
MJCReadable, java.lang.Runnable

public class MJCReadableHasAIS
extends java.lang.Object
implements MJCReadable, java.lang.Runnable

Class for creating a link between an InputStream and the MJC layer hierarchy. This class acts as a MJCReadable, this means it reads data from the specified InputStream and then forwards it to the MJCReader through the readEvent mechanism. Reading is buffered. Reading fromt the InputStream happens in a different thread as in which the MJCReadableHasAIS has been constructed.


Constructor Summary
MJCReadableHasAIS(java.io.InputStream is)
          Constructor.
 
Method Summary
 int getAvailable()
          Returns the number of bytes that can be read from this object.
 java.lang.String getInput()
          Returns the contents of the read buffer.
 java.lang.String getReadableName()
          Returns the MJC name of the MJCReadable.
 java.lang.String getReadableVersion()
          Returns the MJC version of the MJCReadable.
 MJCReader getReader()
          Returns the MJCReader to which the readEvents will be sent.
 boolean isReadableConnected()
          Returns wether the InputStream is still connected or the stream has reached an end.
 void run()
          Entry point for the InputStream reader thread.
 void setReader(MJCReader reader)
          Sets the MJCReader to which the readEvents has to be sent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MJCReadableHasAIS

public MJCReadableHasAIS(java.io.InputStream is)
Constructor. The InputStream to read from has to be specified.
Parameters:
InputStream - is: the InputStream to read from
Method Detail

getReadableName

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

getReadableVersion

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

getAvailable

public int getAvailable()
Returns the number of bytes that can be read from this object.
Specified by:
getAvailable in interface MJCReadable
Returns:
int: the number of bytes that can be read

getInput

public java.lang.String getInput()
Returns the contents of the read buffer.
Specified by:
getInput in interface MJCReadable
Returns:
String: the contents of the read buffer

isReadableConnected

public boolean isReadableConnected()
Returns wether the InputStream is still connected or the stream has reached an end.
Specified by:
isReadableConnected in interface MJCReadable
Returns:
boolean: wether the InputStream is still connected

setReader

public void setReader(MJCReader reader)
Sets the MJCReader to which the readEvents has to be sent.
Specified by:
setReader in interface MJCReadable
Parameters:
MJCReader - reader: the MJCReader to which the readEvents have to be sent

getReader

public MJCReader getReader()
Returns the MJCReader to which the readEvents will be sent.
Specified by:
getReader in interface MJCReadable
Returns:
MJCReader: the MJCReader to which the readEvents will be sent

run

public void run()
Entry point for the InputStream reader thread.
Specified by:
run in interface java.lang.Runnable