java/automation/src/main/java/be/bosa/dt/best/automation/services/ZipService.java
/**
	 * Perform some quick checks and unzip into an existing directory
	 * 
	 * @param infile zip input file
	 * @param outdir output directory
	 * @return false on error
	 */
Perform some quick checks and unzip into an existing directory

@param infile zip input file
@param outdir output directory
@return false on error
Perform some quick checks and unzip into an existing directory @param infile zip input file @param outdir output directory @return false on error
public boolean unzip(String infile, String outdir) {
		Path pin = Paths.get(infile);
		if (! (Files.exists(pin) && Files.isRegularFile(pin))) {
			LOG.errorf("Could not find input file %s", pin);
			return false;
		}
		Path pout = Paths.get(outdir);
		if (! (Files.exists(pout) && Files.isDirectory(pout))) {
			LOG.errorf("Could not find output directory %s", pout);
			return false;
		}
		try {
			LOG.infof("Zip file %s", infile);
			unzip(pin, pout);
		} catch (IOException ioe) {
			LOG.error("Error unzipping", ioe);
			return false;
		}
		return true;
	}
public boolean unzip ( String infile , String outdir ) { Path pin = Paths . get ( infile ) ; if ( ! ( Files . exists ( pin ) && Files . isRegularFile ( pin ) ) ) { LOG . errorf ( "Could not find input file %s" , pin ) ; return false ; } Path pout = Paths . get ( outdir ) ; if ( ! ( Files . exists ( pout ) && Files . isDirectory ( pout ) ) ) { LOG . errorf ( "Could not find output directory %s" , pout ) ; return false ; } try { LOG . infof ( "Zip file %s" , infile ) ; unzip ( pin , pout ) ; } catch ( IOException ioe ) { LOG . error ( "Error unzipping" , ioe ) ; return false ; } return true ; }
Perform some quick checks and unzip into an existing directory
Perform some quick checks and unzip into an existing directory