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); }
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"); } }
public String toString() { return buf.toString(); }