simplified the implementation of the write method.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1712 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2007-01-08 17:19:35 +00:00
1 parent fbc918b1f5
commit 2d93ee8d4a
1 file changed
+4 -10
+4 -10
View File
@@ -438,24 +438,18 @@ public final class FilePath implements Serializable {
* If this file already exists, it will be overwritten.
* If the directory doesn't exist, it will be created.
*/
public OutputStream write() throws IOException {
public OutputStream write() throws IOException, InterruptedException {
if(channel==null)
return new FileOutputStream(new File(remote));
final Pipe p = Pipe.createLocalToRemote();
channel.callAsync(new Callable<Void,IOException>() {
public Void call() throws IOException {
return channel.call(new Callable<OutputStream,IOException>() {
public OutputStream call() throws IOException {
File f = new File(remote);
f.getParentFile().mkdirs();
FileOutputStream fos = new FileOutputStream(f);
Util.copyStream(p.getIn(),fos);
fos.close();
p.getIn().close();
return null;
return new RemoteOutputStream(fos);
}
});
return p.getOut();
}
/**