1 7 package fr.jayasoft.ivy.repository; 8 9 import java.io.File ; 10 import java.net.MalformedURLException ; 11 12 import fr.jayasoft.ivy.repository.file.FileResource; 13 import fr.jayasoft.ivy.repository.url.URLResource; 14 15 public class ResourceHelper { 16 public static boolean equals(Resource res, File f) { 17 if (res == null && f == null) { 18 return true; 19 } 20 if (res == null || f == null) { 21 return false; 22 } 23 if (res instanceof FileResource) { 24 return new File (res.getName()).equals(f); 25 } else if (res instanceof URLResource) { 26 try { 27 return f.toURL().toExternalForm().equals(res.getName()); 28 } catch (MalformedURLException e) { 29 return false; 30 } 31 } 32 return false; 33 } 34 } 35 | Popular Tags |