提交 2d93ee8d 编写于 作者: K kohsuke

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
上级 fbc918b1
......@@ -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();
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册