Unzips the input stream via a gzip filter. use gunzip(ByteSource, File, Predicate) if possible

@param in      The input stream to run through the gunzip filter. This stream is closed
@param outFile The file to output to

@throws IOException
547082
public static FileUtils.FileCopyResult gunzip(InputStream in, File outFile) throws IOException
  {
    try (GZIPInputStream gzipInputStream = gzipInputStream(in)) {
      NativeIO.chunkedCopy(gzipInputStream, outFile);
      return new FileUtils.FileCopyResult(outFile);
    }
  }
187155
public static List<String> unzip(final File zipFile, final String destination, String encoding) {
    List<String> fileNames = CollectUtils.newArrayList();
    String dest = destination;
    if (!destination.endsWith(File.separator)) {
      dest = destination + File.separator;
    }
    ZipFile file;
    try {
      file = null;
      if (null == encoding) file = new ZipFile(zipFile);
      else file = new ZipFile(zipFile, encoding);
      Enumeration<ZipArchiveEntry> en = file.getEntries();
      ZipArchiveEntry ze = null;
      while (en.hasMoreElements()) {
        ze = en.nextElement();
        File f = new File(dest, ze.getName());
        if (ze.isDirectory()) {
          f.mkdirs();
          continue;
        } else {
          f.getParentFile().mkdirs();
          InputStream is = file.getInputStream(ze);
          OutputStream os = new FileOutputStream(f);
          IOs.copy(is, os);
          is.close();
          os.close();
          fileNames.add(f.getAbsolutePath());
        }
      }
      file.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
    return fileNames;
  }
1342659
public static FileUtils.FileCopyResult gunzip(final File pulledFile, File outFile)
  {
    return gunzip(Files.asByteSource(pulledFile), outFile);
  }
1149115
private static void compressGZip(Resource source, Resource target) throws IOException {
	if (source.isDirectory()) {
	    throw new IOException("you can only create a GZIP File from a single source file, use TGZ (TAR-GZIP) to first TAR multiple files");
	}
	InputStream is = null;
	OutputStream os = null;
	try {
	    is = source.getInputStream();
	    os = target.getOutputStream();
	}
	catch (IOException ioe) {
	    IOUtil.closeEL(is, os);
	    throw ioe;
	}
	compressGZip(is, os);

    }
902433
def decompress(infile, outdir='.'):
    
    cmd = get_xritdecompress_cmd()
    infile = os.path.abspath(infile)
    cwd = os.getcwd()
    os.chdir(outdir)

    p = Popen([cmd, infile], stdout=PIPE)
    stdout = BytesIO(p.communicate()[0])
    status = p.returncode
    os.chdir(cwd)

    if status != 0:
        raise IOError("xrit_decompress '%s', failed, status=%d" % (infile, status))

    outfile = get_xritdecompress_outfile(stdout)

    if not outfile:
        raise IOError("xrit_decompress '%s', failed, no output file is generated" % infile)

    return os.path.join(outdir, outfile.decode('utf-8'))
348471
static public byte[] unzip(InputStream in) throws IOException {
		ByteArrayOutputStream bos = new ByteArrayOutputStream();
		CopyUtil.copy(new GZIPInputStream(in), bos);
		return bos.toByteArray();
	}
648714
private static void inflater(InputStream in, OutputStream out) {
		final InflaterOutputStream ios = (out instanceof InflaterOutputStream) ? (InflaterOutputStream) out : new InflaterOutputStream(out, new Inflater(true));
		IoUtil.copy(in, ios);
		try {
			ios.finish();
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
	}
495997
private static void copy(ZipFile zipFile, ZipEntry zipEntry, File outItemFile) throws IOException {
		InputStream in = null;
		OutputStream out = null;
		try {
			in = zipFile.getInputStream(zipEntry);
			out = FileUtil.getOutputStream(outItemFile);
			IoUtil.copy(in, out);
		} finally {
			IoUtil.close(out);
			IoUtil.close(in);
		}
	}
954142
public static void decodeFileToFile(String infile, String outfile) throws IOException {
		byte[] decoded = Base64.decodeFromFile(infile);
		java.io.OutputStream out = null;
		try{
			out = new java.io.BufferedOutputStream(new FileOutputStream(outfile));
			out.write(decoded);
		} catch (IOException e) {
			throw e; // Catch and release to execute finally{}
		} finally {
			try {
				if (out != null) {
					out.close();
				}
			} catch (Exception ex) {
			}
		}
	}
416260
public static void copy(byte[] in, File out) throws IOException {
		Assert.notNull(in, "No input byte array specified");
		Assert.notNull(out, "No output File specified");
		ByteArrayInputStream inStream = new ByteArrayInputStream(in);
		OutputStream outStream = new BufferedOutputStream(new FileOutputStream(out));
		copy(inStream, outStream);
	}
374549
public static File compress(CompressionMethod _method, String _sourceFile, String _outputFileName) {
    	if (_method == null || _sourceFile == null) {
    		return null;
    	}

        File inputFile = new File(_sourceFile);

        if (!inputFile.exists()) {
            return null;
        }

        byte[] buffer = new byte[1024];
        try {
        	Constructor<? extends DeflaterOutputStream> constructor = _method.getOutputStreamClass().getConstructor(OutputStream.class);
        	if (constructor != null) {
        		DeflaterOutputStream compressOutputStream = constructor.newInstance(new FileOutputStream(_outputFileName));
	            try (FileInputStream in = new FileInputStream(_sourceFile)) {
	                int len;
	                while ((len = in.read(buffer)) > 0) {
	                    compressOutputStream.write(buffer, 0, len);
	                }

	                in.close();

	                compressOutputStream.finish();
	                compressOutputStream.close();
	                return new File(_outputFileName);
	            }
        	}
        } catch (IOException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException _ex) {
            LOGGER.error("Cannot uncompress file: ", _ex);
        }
        return null;

    }
541104
public static void unzip(InputStream is, File destDir)
            throws FileNotFoundException, IOException {
        BufferedOutputStream dest = null;
        ZipInputStream zis = new ZipInputStream(new BufferedInputStream(is));
        ZipEntry entry;
        while ((entry = zis.getNextEntry()) != null) {
            //System.out.println("Extracting: " + entry);
            if (entry.isDirectory()) {
                // Otherwise, empty directories do not get created
                (new File(destDir, entry.getName())).mkdirs();
            } else {
                File f = new File(destDir, entry.getName());
                f.getParentFile().mkdirs();
                int count;
                byte data[] = new byte[BUFFER];
                // write the files to the disk
                FileOutputStream fos = new FileOutputStream(f);
                dest = new BufferedOutputStream(fos, BUFFER);
                while ((count = zis.read(data, 0, BUFFER)) != -1) {
                    dest.write(data, 0, count);
                }
                dest.flush();
                dest.close();
            }
        }
        zis.close();
    }
1329881
public static void unzipToFolder(File inputFile, File outputDir) throws IOException
    {
        if (inputFile == null)
            throw new IllegalArgumentException("Argument inputFile is null.");
        if (outputDir == null)
            throw new IllegalArgumentException("Argument outputDir is null.");

        try (ZipFile zipFile = new ZipFile(inputFile))
        {
            Enumeration<? extends ZipEntry> entryEnum = zipFile.entries();
            while (entryEnum.hasMoreElements())
            {
                ZipEntry entry = entryEnum.nextElement();
                String entryName = entry.getName();
                File destFile = new File(outputDir, entryName);
                if (!entry.isDirectory())
                {
                    File parentDir = destFile.getParentFile();
                    if (!parentDir.isDirectory() && !parentDir.mkdirs())
                    {
                        throw new WindupException("Unable to create directory: " + parentDir.getAbsolutePath());
                    }
                    try (InputStream zipInputStream = zipFile.getInputStream(entry))
                    {
                        try (FileOutputStream outputStream = new FileOutputStream(destFile))
                        {
                            Streams.write(zipInputStream, outputStream);
                        }
                    }
                }
            }
        }
    }
759070
public static void toHalfWidthFile(String infile, String outfile) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(
				new FileInputStream(infile), "utf8"));
		BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(
				outfile), "utf8"));

		String line = null;
		while ((line = in.readLine()) != null) {
			line = line.trim();	
			if(line.length()==0)
				continue;
			line = toHalfWidth(line);
			out.write(line);
			out.newLine();
		}
		in.close();
		out.close();

	}
1209484
private void unzip(final File file, final String outputDir) throws IOException {

		try (final ZipFile zipFile = new ZipFile(file)) {

			final Enumeration<? extends ZipEntry> entries = zipFile.entries();

			while (entries.hasMoreElements()) {

				final ZipEntry entry = entries.nextElement();
				final File targetFile = new File(outputDir, entry.getName());

				if (entry.isDirectory()) {

					targetFile.mkdirs();

				} else {

					targetFile.getParentFile().mkdirs();
					InputStream in = zipFile.getInputStream(entry);

					try (OutputStream out = new FileOutputStream(targetFile)) {

						IOUtils.copy(in, out);
						IOUtils.closeQuietly(in);
					}
				}
			}
		}
	}
1065311
private static boolean encodeFileToFile(String infile, String outfile)
	{
		boolean success = false;
		java.io.InputStream in = null;
		java.io.OutputStream out = null;
		try
		{
			in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.ENCODE);
			out = new java.io.BufferedOutputStream(new java.io.FileOutputStream(outfile));
			byte[] buffer = new byte[65536]; // 64K
			int read = -1;
			while ((read = in.read(buffer)) >= 0)
			{
				out.write(buffer, 0, read);
			} // end while: through file
			success = true;
		}
		catch (java.io.IOException exc)
		{
		}
		finally
		{
			try
			{
				in.close();
			}
			catch (Exception exc)
			{
			}
			try
			{
				out.close();
			}
			catch (Exception exc)
			{
			}
		} // end finally

		return success;
	}
1358851
@SuppressWarnings("PMD.AssignmentInOperand")
  static byte[] gunzip(byte[] data) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream(data.length * 10);
    try (InputStream in = new GZIPInputStream(new ByteArrayInputStream(data))) {
      byte[] buffer = new byte[4096];
      int length;
      while ((length = in.read(buffer)) > 0) {
        baos.write(buffer, 0, length);
      }
    }
    return baos.toByteArray();
  }