Пример #1
0
  private static String fileListToString(List<File> list, String exclude) {
    if (list.isEmpty()) return "";

    StringBuffer buffy = new StringBuffer();

    for (File file : list) {
      String name = file.getName();
      int dot = name.lastIndexOf(".");

      if (exclude != null && name.contains(exclude)) {
        continue;
      }

      buffy.append(", " + name.substring(0, dot));
    }

    // Trim off the first ", ".
    return buffy.substring(2);
  }
Пример #2
0
 public void run() {
   try {
     String line = in.readLine();
     while (line != null) {
       buf.append(line);
       buf.append('\n');
       line = in.readLine();
     }
   } catch (IOException ioe) {
     System.err.println("can't read output from process");
   }
 }
Пример #3
0
 public String toString() {
   return buf.toString();
 }