Ejemplo n.º 1
0
 /**
  * Gets the local user's DNS names
  *
  * @return The local user's DNS names
  */
 public static String[] getPersonalDNSes() {
   synchronized (monitor) {
     final String[] rc = new String[myDNSes.size()];
     myDNSes.toArray(rc);
     return rc;
   }
 }
Ejemplo n.º 2
0
 /**
  * Load, creates if missing, information about the local users
  *
  * @param file The file with the data
  * @throws IOException On I/O error
  */
 private static void loadMe(final String file) throws IOException {
   myFile = file;
   final File $file = new File(file);
   if ($file.exists() == false) {
     myUUID = UUID.randomUUID();
     updateMe(null);
   } else {
     ObjectInputStream is = null;
     try {
       is = new ObjectInputStream(new BufferedInputStream(new FileInputStream($file)));
       Object obj;
       for (; ; )
         if ((obj = is.readObject()) instanceof UUID) {
           System.err.println("Loading UUID: " + obj);
           myUUID = (UUID) obj;
           break;
         } else {
           System.err.println("Loading DNS: " + obj);
           myDNSes.add((String) obj);
         }
     } catch (final ClassNotFoundException err) {
       throw new IOError(err);
     } finally {
       if (is != null)
         try {
           is.close();
         } catch (final Throwable err) {
           // Do nothing
         }
     }
   }
 }