Package com.parctechnologies.eclipse
Class FromEclipseQueue
- java.lang.Object
-
- java.io.InputStream
-
- com.parctechnologies.eclipse.FromEclipseQueue
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class FromEclipseQueue extends java.io.InputStreamA queue for sending data from ECLiPSe to Java. This class performs no processing of the data and cannot for example, deal with EXDR format (seeEXDRInputStreamfor 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
QueueListenerobject 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 theEclipseConnectioninterface or thegetEclipseStderr()orgetEclipseStdout()method of an object implementing theEclipseEngineinterface.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()Closes the queue (both eclipse and Java sides), removing any listener.intread()intread(byte[] b, int off, int len)Read bytes from the FromEclipseQueue into a byte array.voidremoveListener()Detach any QueueListener from this FromEclipseQueue.voidsetListener(QueueListener l)Attach a QueueListener to this FromEclipseQueue for handling incoming data.
-
-
-
Method Detail
-
available
public int available() throws java.io.IOException- Overrides:
availablein classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOExceptionRead bytes from the FromEclipseQueue into a byte array.lenbytes are read from the queue and stored in byte arraybat offsetoff.- Overrides:
readin classjava.io.InputStream- Returns:
- the number of bytes read.
- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.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, thedataAvailable()method of the QueueListener is invoked.- Throws:
java.io.IOException
-
removeListener
public void removeListener() throws java.io.IOExceptionDetach any QueueListener from this FromEclipseQueue.- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionCloses the queue (both eclipse and Java sides), removing any listener.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
-