Package org.globus.io.gass.server
Class JobOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.globus.io.gass.server.JobOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class JobOutputStream extends OutputStream
This is a small class that allows to redirect a job's output to a custom job output listener. That is, a listener that presents/displays the job output in a specific way. For example, this class can be used to redirect a job's output to a window.This class is specificaly designed for jobs that generate textual output. Binary data might not be handled correctly.
-
-
Field Summary
Fields Modifier and Type Field Description protected JobOutputListener
listener
-
Constructor Summary
Constructors Constructor Description JobOutputStream(JobOutputListener jobListener)
Creates a job output stream with a specific job output listener to which the job output will be redirected to.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Notifies the job output listener that no more output will be produced.void
write(byte[] b, int off, int len)
Converts the byte array to a string and forwards it to the job output listener.void
write(int b)
Converts the int to a string and forwards it to the job output listener.-
Methods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
-
-
-
Field Detail
-
listener
protected JobOutputListener listener
-
-
Constructor Detail
-
JobOutputStream
public JobOutputStream(JobOutputListener jobListener)
Creates a job output stream with a specific job output listener to which the job output will be redirected to.- Parameters:
jobListener
- an instance of the job output listener. Cannot be null.
-
-
Method Detail
-
write
public void write(byte[] b, int off, int len) throws IOException
Converts the byte array to a string and forwards it to the job output listener.
Called by the GassServer.- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(int b) throws IOException
Converts the int to a string and forwards it to the job output listener.
Called by the GassServer.- Specified by:
write
in classOutputStream
- Throws:
IOException
-
close
public void close() throws IOException
Notifies the job output listener that no more output will be produced.
Called by the GassServer.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
-