Search in sources :

Example 1 with RemoteInputStream

use of hudson.remoting.RemoteInputStream in project hudson-2.x by hudson.

the class FilePath method untarFrom.

/**
     * Reads the given InputStream as a tar file and extracts it into this directory.
     *
     * @param _in
     *      The stream will be closed by this method after it's fully read.
     * @param compression
     *      The compression method in use.
     * @since 1.292
     */
public void untarFrom(InputStream _in, final TarCompression compression) throws IOException, InterruptedException {
    try {
        final InputStream in = new RemoteInputStream(_in);
        act(new FileCallable<Void>() {

            public Void invoke(File dir, VirtualChannel channel) throws IOException {
                readFromTar("input stream", dir, compression.extract(in));
                return null;
            }

            private static final long serialVersionUID = 1L;
        });
    } finally {
        IOUtils.closeQuietly(_in);
    }
}
Also used : VirtualChannel(hudson.remoting.VirtualChannel) GZIPInputStream(java.util.zip.GZIPInputStream) BufferedInputStream(java.io.BufferedInputStream) RemoteInputStream(hudson.remoting.RemoteInputStream) ObjectInputStream(java.io.ObjectInputStream) ZipInputStream(java.util.zip.ZipInputStream) TarInputStream(hudson.org.apache.tools.tar.TarInputStream) CountingInputStream(org.apache.commons.io.input.CountingInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) RemoteInputStream(hudson.remoting.RemoteInputStream) IOException(java.io.IOException) File(java.io.File)

Example 2 with RemoteInputStream

use of hudson.remoting.RemoteInputStream in project hudson-2.x by hudson.

the class FilePath method unzipFrom.

/**
     * Reads the given InputStream as a zip file and extracts it into this directory.
     *
     * @param _in
     *      The stream will be closed by this method after it's fully read.
     * @since 1.283
     * @see #unzip(FilePath)
     */
public void unzipFrom(InputStream _in) throws IOException, InterruptedException {
    final InputStream in = new RemoteInputStream(_in);
    act(new FileCallable<Void>() {

        public Void invoke(File dir, VirtualChannel channel) throws IOException {
            unzip(dir, in);
            return null;
        }

        private static final long serialVersionUID = 1L;
    });
}
Also used : VirtualChannel(hudson.remoting.VirtualChannel) GZIPInputStream(java.util.zip.GZIPInputStream) BufferedInputStream(java.io.BufferedInputStream) RemoteInputStream(hudson.remoting.RemoteInputStream) ObjectInputStream(java.io.ObjectInputStream) ZipInputStream(java.util.zip.ZipInputStream) TarInputStream(hudson.org.apache.tools.tar.TarInputStream) CountingInputStream(org.apache.commons.io.input.CountingInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) RemoteInputStream(hudson.remoting.RemoteInputStream) IOException(java.io.IOException) File(java.io.File)

Aggregations

TarInputStream (hudson.org.apache.tools.tar.TarInputStream)2 RemoteInputStream (hudson.remoting.RemoteInputStream)2 VirtualChannel (hudson.remoting.VirtualChannel)2 BufferedInputStream (java.io.BufferedInputStream)2 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 ObjectInputStream (java.io.ObjectInputStream)2 GZIPInputStream (java.util.zip.GZIPInputStream)2 ZipInputStream (java.util.zip.ZipInputStream)2 CountingInputStream (org.apache.commons.io.input.CountingInputStream)2