public List<String> getList() {
        List<String> ret = new ArrayList<String>();
        for (String s : Regex.getLines(getText())) {
            if (StringUtils.isNotEmpty(s)) {
                ret.add(s.trim());
            }
        }
        return ret;

    }
Exemple #2
0
 private java.util.List<File> addFolderToZip(String path, String srcFolder, ZipOutputStream zip)
     throws Exception {
   ArrayList<File> ret = new ArrayList<File>();
   File folder = new File(srcFolder);
   if (excludeFiles.contains(folder)) {
     return ret;
   }
   for (String fileName : folder.list()) {
     if (excludeFilter != null) {
       if (Regex.matches(fileName, excludeFilter)) {
         System.out.println("Filtered: " + fileName);
         continue;
       }
     }
     if (path.equals("")) {
       ret.addAll(addFileToZip(folder.getName(), srcFolder + "/" + fileName, zip));
     } else {
       ret.addAll(addFileToZip(path + "/" + folder.getName(), srcFolder + "/" + fileName, zip));
     }
   }
   return ret;
 }
Exemple #3
0
  private java.util.List<File> addFileToZip(String path, String srcFile, ZipOutputStream zip)
      throws Exception {
    ArrayList<File> ret = new ArrayList<File>();
    if (srcFile.endsWith("Thumbs.db")) {
      return null;
    }
    if (excludeFilter != null) {
      if (Regex.matches(srcFile, excludeFilter)) {

        System.out.println("Filtered: " + srcFile);
        return ret;
      }
    }
    File folder = new File(srcFile);
    if (excludeFiles != null && excludeFiles.contains(folder)) {
      return ret;
    }
    if (folder.isDirectory()) {
      ret.addAll(addFolderToZip(path, srcFile, zip));
      if (this.deleteAfterPack) FileCreationManager.getInstance().delete(new File(srcFile), null);
    } else {
      byte[] buf = new byte[1024];
      int len;
      FileInputStream in = new FileInputStream(srcFile);
      if (path == null || path.trim().length() == 0) {
        zip.putNextEntry(new ZipEntry(folder.getName()));
      } else {
        zip.putNextEntry(new ZipEntry(path + "/" + folder.getName()));
      }

      while ((len = in.read(buf)) > 0) {
        zip.write(buf, 0, len);
      }
      in.close();
      if (this.deleteAfterPack) FileCreationManager.getInstance().delete(new File(srcFile), null);
      ret.add(new File(srcFile));
    }
    return ret;
  }