Example #1
0
 @Override
 public int compareTo(VFileInfo o) {
   if (file.isDirectory() != o.file.isDirectory()) {
     return file.isDirectory() ? -1 : 1;
   }
   return file.getName().compareToIgnoreCase(o.file.getName());
 }
Example #2
0
 public long length() {
   if (file.isFile()) {
     return file.length();
   }
   if (file.isDirectory()) {
     VFile[] files = file.listFiles();
     return files == null ? 0 : files.length;
   }
   return 0;
 }
Example #3
0
 public String lengthDesc() {
   if (file.isFile()) {
     return VrUtils.formatFileSize(file.length());
   }
   if (file.isDirectory()) {
     VFile[] files = file.listFiles();
     int f = 0;
     int d = 0;
     if (files != null) {
       for (VFile ff : files) {
         if (ff.isDirectory()) {
           d++;
         } else {
           f++;
         }
       }
     }
     if (f == 0 && d == 0) {
       return "vide";
     }
     StringBuilder sb = new StringBuilder();
     if (d > 0) {
       sb.append(d).append(" rep.");
     }
     if (f > 0) {
       if (sb.length() > 0) {
         sb.append(", ");
       }
       sb.append(f).append(" fich.");
     }
     return sb.toString();
   }
   return "";
 }
Example #4
0
 public Date getLastModifiedDate() {
   return new Date(file.lastModified());
 }