コード例 #1
0
 /**
  * Returns the canonical file name for the given file, or "standard output" if the file name is
  * empty.
  */
 private String fileName(File file) {
   if (isFile(file)) {
     try {
       return file.getCanonicalPath();
     } catch (IOException ex) {
       return file.getPath();
     }
   } else {
     return "standard output";
   }
 }
コード例 #2
0
 /**
  * Returns whether the given file is actually a file, or just a placeholder for the standard
  * output.
  */
 private boolean isFile(File file) {
   return file.getPath().length() > 0;
 }