com.parctechnologies.eclipse
Class FromEclipseQueue

java.lang.Object
  extended by java.io.InputStream
      extended by com.parctechnologies.eclipse.FromEclipseQueue
All Implemented Interfaces:
java.io.Closeable

public class FromEclipseQueue
extends java.io.InputStream

A queue for sending data from ECLiPSe to Java. This class performs no processing of the data and cannot for example, deal with EXDR format (see EXDRInputStream for a class which can handle this).

In addition to the standard methods inherited from its superclass, this class also provides the ability to attach a QueueListener object to the FromEclipseQueue, as a handler for incoming data.

There is no public constructor; to access an FromEclipseQueue use the createFromEclipseQueue() of an object implementing the EclipseConnection interface or the getEclipseStderr() or getEclipseStdout() method of an object implementing the EclipseEngine interface.


Method Summary
 int available()
           
 void close()
          Closes the queue (both eclipse and Java sides), removing any listener.
 int read()
           
 int read(byte[] b, int off, int len)
          Read bytes from the FromEclipseQueue into a byte array.
 void removeListener()
          Detach any QueueListener from this FromEclipseQueue.
 void setListener(QueueListener l)
          Attach a QueueListener to this FromEclipseQueue for handling incoming data.
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

available

public int available()
              throws java.io.IOException
Overrides:
available in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Read bytes from the FromEclipseQueue into a byte array. len bytes are read from the queue and stored in byte array b at offset off.

Overrides:
read in class java.io.InputStream
Returns:
the number of bytes read.
Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

setListener

public void setListener(QueueListener l)
                 throws java.io.IOException
Attach a QueueListener to this FromEclipseQueue for handling incoming data. When ECLiPSe flushes the queue, the dataAvailable() method of the QueueListener is invoked.

Throws:
java.io.IOException

removeListener

public void removeListener()
                    throws java.io.IOException
Detach any QueueListener from this FromEclipseQueue.

Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Closes the queue (both eclipse and Java sides), removing any listener.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException