hudson.remoting
Class RemoteOutputStream
java.lang.Object
java.io.OutputStream
hudson.remoting.RemoteOutputStream
- All Implemented Interfaces:
- Closeable, Flushable, Serializable
public final class RemoteOutputStream
- extends OutputStream
- implements Serializable
OutputStream that can be sent over to the remote Channel,
so that the remote Callable can write to a local OutputStream.
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
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RemoteOutputStream
public RemoteOutputStream(OutputStream core)
write
public void write(int b)
throws IOException
- Specified by:
write in class OutputStream
- Throws:
IOException
write
public void write(byte[] b)
throws IOException
- Overrides:
write in class OutputStream
- Throws:
IOException
write
public void write(byte[] b,
int off,
int len)
throws IOException
- Overrides:
write in class OutputStream
- Throws:
IOException
flush
public void flush()
throws IOException
- Specified by:
flush in interface Flushable- Overrides:
flush in class OutputStream
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close in interface Closeable- Overrides:
close in class OutputStream
- Throws:
IOException
Copyright © 2004-2011. All Rights Reserved.