mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-02 22:55:53 +00:00
file system provisioner related changes
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@12252 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
674845c1ad
commit
c3f4ead8a5
3 files changed
+35
-2
No files matched your search
@@ -25,6 +25,7 @@ import org.apache.tools.tar.TarOutputStream;
|
||||
import org.apache.tools.zip.ZipOutputStream;
|
||||
import org.apache.tools.zip.ZipEntry;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
@@ -326,6 +327,30 @@ public final class FilePath implements Serializable {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Place the data from {@link FileItem} into the file location specified by this {@link FilePath} object.
|
||||
*/
|
||||
public void copyFrom(FileItem file) throws IOException, InterruptedException {
|
||||
if(channel==null) {
|
||||
try {
|
||||
file.write(new File(remote));
|
||||
} catch (IOException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new IOException2(e);
|
||||
}
|
||||
} else {
|
||||
InputStream i = file.getInputStream();
|
||||
OutputStream o = write();
|
||||
try {
|
||||
IOUtils.copy(i,o);
|
||||
} finally {
|
||||
o.close();
|
||||
i.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Code that gets executed on the machine where the {@link FilePath} is local.
|
||||
* Used to act on {@link FilePath}.
|
||||
|
||||
Reference in new issue
Block a user