private void zip(ZipOutputStream out, File file, String base) { try { if (file.isDirectory()) { File[] subFiles = file.listFiles(); if (subFiles.length == 0) { out.putNextEntry(new ZipEntry(base + "/")); } for (int i = 0; i < subFiles.length; i++) { zip(out, subFiles[i], base + "/" + subFiles[i].getName()); } } else { out.putNextEntry(new ZipEntry(base)); FileInputStream in = new FileInputStream(file); BufferedInputStream bi = new BufferedInputStream(in); int size; while ((size = bi.read()) != -1) { out.write(size); } out.closeEntry(); in.close(); } } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { final String module = "VtsVndkDependencyTest"; VTS vts = new VTS(module); String result = vts.runVTS(); System.out.println("test result:" + result); System.out.println("LOG:" + module + COMPRESS_POSTFIX_NAME); }