src/com/esotericsoftware/scar/Scar.java
static public String unzip (String zipFile, String outputDir) throws IOException {
		if (zipFile == null) throw new IllegalArgumentException("zipFile cannot be null.");
		if (outputDir == null) throw new IllegalArgumentException("outputDir cannot be null.");

		if (DEBUG) debug("scar", "ZIP decoding: " + zipFile + " -> " + outputDir);

		ZipInputStream input = new ZipInputStream(new FileInputStream(zipFile));
		try {
			byte[] buffer = new byte[1024 * 10];
			while (true) {
				ZipEntry entry = input.getNextEntry();
				if (entry == null) break;
				File file = new File(outputDir, entry.getName());
				if (entry.isDirectory()) {
					mkdir(file.getPath());
					continue;
				}
				mkdir(file.getParent());
				FileOutputStream output = new FileOutputStream(file);
				try {
					while (true) {
						int length = input.read(buffer);
						if (length == -1) break;
						output.write(buffer, 0, length);
					}
				} finally {
					try {
						output.close();
					} catch (Exception ignored) {
					}
				}
			}
		} finally {
			try {
				input.close();
			} catch (Exception ignored) {
			}
		}
		return outputDir;
	}
/** Decodes the specified ZIP file.
	 * @return The path to the output directory. */
Decodes the specified ZIP file.
@return The path to the output directory.
Decodes the specified ZIP file . @return The path to the output directory .
static public String unzip (String zipFile, String outputDir) throws IOException {
		if (zipFile == null) throw new IllegalArgumentException("zipFile cannot be null.");
		if (outputDir == null) throw new IllegalArgumentException("outputDir cannot be null.");
		if (DEBUG) debug("scar", "ZIP decoding: " + zipFile + " -> " + outputDir);
		ZipInputStream input = new ZipInputStream(new FileInputStream(zipFile));
		try {
			byte[] buffer = new byte[1024 * 10];
			while (true) {
				ZipEntry entry = input.getNextEntry();
				if (entry == null) break;
				File file = new File(outputDir, entry.getName());
				if (entry.isDirectory()) {
					mkdir(file.getPath());
					continue;
				}
				mkdir(file.getParent());
				FileOutputStream output = new FileOutputStream(file);
				try {
					while (true) {
						int length = input.read(buffer);
						if (length == -1) break;
						output.write(buffer, 0, length);
					}
				} finally {
					try {
						output.close();
					} catch (Exception ignored) {
					}
				}
			}
		} finally {
			try {
				input.close();
			} catch (Exception ignored) {
			}
		}
		return outputDir;
	}
static public String unzip ( String zipFile , String outputDir ) throws IOException { if ( zipFile == null ) throw new IllegalArgumentException ( "zipFile cannot be null." ) ; if ( outputDir == null ) throw new IllegalArgumentException ( "outputDir cannot be null." ) ; if ( DEBUG ) debug ( "scar" , "ZIP decoding: " + zipFile + " -> " + outputDir ) ; ZipInputStream input = new ZipInputStream ( new FileInputStream ( zipFile ) ) ; try { byte [ ] buffer = new byte [ 1024 * 10 ] ; while ( true ) { ZipEntry entry = input . getNextEntry ( ) ; if ( entry == null ) break ; File file = new File ( outputDir , entry . getName ( ) ) ; if ( entry . isDirectory ( ) ) { mkdir ( file . getPath ( ) ) ; continue ; } mkdir ( file . getParent ( ) ) ; FileOutputStream output = new FileOutputStream ( file ) ; try { while ( true ) { int length = input . read ( buffer ) ; if ( length == - 1 ) break ; output . write ( buffer , 0 , length ) ; } } finally { try { output . close ( ) ; } catch ( Exception ignored ) { } } } } finally { try { input . close ( ) ; } catch ( Exception ignored ) { } } return outputDir ; }
Decodes the specified ZIP file.
Decodes the specified ZIP file .