示例#1
0
 public void allDisks() {
   try {
     System.out.println("Discurile existente in sistem:");
     String line;
     int i = 0;
     BufferedReader br = new BufferedReader(new FileReader("disks.txt"));
     while ((line = br.readLine()) != null) {
       i++;
       System.out.println("" + i + ":" + line);
     }
   } catch (Exception e) {
   } finally {
     takePath();
   }
 }
示例#2
0
 // incarca un disk existent de pe HDD; trebuie folosit un obiect de tip FileDialog
 public void load(String diskName) {
   try {
     String line;
     boolean ok = false;
     BufferedReader br = new BufferedReader(new FileReader("disks.txt"));
     while ((line = br.readLine()) != null) {
       if (line.equals(diskName)) ok = true;
     }
     if (ok == true) {
       System.out.println("Discul " + diskName + " a fost incarcat");
       currentDiskPath = System.getProperty("user.dir").toString() + "\\" + diskName;
       currentPath = currentDiskPath;
     } else System.out.println("Discul nu exista!");
   } catch (Exception e) {
   } finally {
     takePath();
   }
 }