From 2d93ee8d4ae0d0580839bdaa24105ec556947390 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Mon, 8 Jan 2007 17:19:35 +0000 Subject: [PATCH] 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 --- core/src/main/java/hudson/FilePath.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index f95779cbbe..326c409739 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -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() { - public Void call() throws IOException { + return channel.call(new Callable() { + 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(); } /** -- GitLab