@SuppressFBWarnings(value="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",justification="File.listFiles() will return null if the File instance is not a directory. " + "Null dereference is not a possibility here since we validate sourceDirectory is " + "directory via sourceDirectory.isDirectory()") public static void zipDirectory(File sourceDirectory,OutputStream outputStream) throws IOException {
  checkNotNull(sourceDirectory);
  checkNotNull(outputStream);
  checkArgument(sourceDirectory.isDirectory(),"%s is not a valid directory",sourceDirectory.getAbsolutePath());
  ZipOutputStream zos=new ZipOutputStream(outputStream);
  for (  File file : sourceDirectory.listFiles()) {
    zipDirectoryInternal(file,"",zos);
  }
  zos.finish();
}

@ SuppressFBWarnings ( value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE" , justification = "File.listFiles() will return null if the File instance is not a directory. " + "Null dereference is not a possibility here since we validate sourceDirectory is " + "directory via sourceDirectory.isDirectory()" ) public static void zipDirectory ( File sourceDirectory , OutputStream outputStream ) throws IOException { checkNotNull ( sourceDirectory ) ; checkNotNull ( outputStream ) ; checkArgument ( sourceDirectory . isDirectory ( ) , "%s is not a valid directory" , sourceDirectory . getAbsolutePath ( ) ) ; ZipOutputStream zos = new ZipOutputStream ( outputStream ) ; for ( File file : sourceDirectory . listFiles ( ) ) { zipDirectoryInternal ( file , "" , zos ) ; } zos . finish ( ) ; }
zips an entire directory specified by the path .
