Package hudson.remoting
Class RemoteOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- hudson.remoting.RemoteOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,Serializable
,AutoCloseable
,SerializableOnlyOverRemoting
public final class RemoteOutputStream extends OutputStream implements SerializableOnlyOverRemoting
OutputStream
that can be sent over to the remoteChannel
, so that the remoteCallable
can write to a localOutputStream
.Usage
To have a remote machine write to a local
OutputStream
:final OutputStream out = new RemoteOutputStream(os); channel.call(new Callable() { public Object call() { // this will write to 'os'. out.write(...); } });
To have a local machine write to a remote
OutputStream
:OutputStream os = channel.call(new Callable() { public Object call() { OutputStream os = new FileOutputStream(...); // or any other OutputStream return new RemoteOutputStream(os); } });
- Author:
- Kohsuke Kawaguchi
- See Also:
RemoteInputStream
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RemoteOutputStream(OutputStream core)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jenkinsci.remoting.SerializableOnlyOverRemoting
getChannelForSerialization
-
-
-
-
Constructor Detail
-
RemoteOutputStream
public RemoteOutputStream(OutputStream core)
-
-
Method Detail
-
write
public void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(@NonNull byte[] b) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(@NonNull byte[] b, int off, int len) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
-