1 21 22 package org.armedbear.j.mail; 23 24 import java.net.MalformedURLException ; 25 import org.armedbear.j.File; 26 27 public final class LocalMailboxURL extends MailboxURL 28 { 29 private final File file; 30 31 public LocalMailboxURL(String s) throws MalformedURLException 32 { 33 if (s.startsWith("mailbox:")) 34 s = s.substring(8); 35 file = File.getInstance(s); 36 if (file == null) 37 throw new MalformedURLException (); 38 } 39 40 public LocalMailboxURL(File file) 41 { 42 this.file = file; 43 setBaseName("mailbox:" + file.canonicalPath()); 44 } 45 46 public final File getFile() 47 { 48 return file; 49 } 50 51 public boolean equals(Object object) 52 { 53 if (!(object instanceof LocalMailboxURL)) 54 return false; 55 return file.equals(((LocalMailboxURL)object).getFile()); 56 } 57 58 public String getCanonicalName() 59 { 60 return file.canonicalPath(); 61 } 62 } 63 | Popular Tags |