hudson.remoting
Class RemoteOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by hudson.remoting.RemoteOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.io.Serializable

public final class RemoteOutputStream
extends java.io.OutputStream
implements java.io.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

Constructor Summary
RemoteOutputStream(java.io.OutputStream core)
           
 
Method Summary
 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.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteOutputStream

public RemoteOutputStream(java.io.OutputStream core)
Method Detail

write

public void write(int b)
           throws java.io.IOException
Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte[] b)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException


Copyright © 2013. All Rights Reserved.