1 16 package org.apache.commons.net.smtp; 17 18 import java.util.Enumeration ; 19 import java.util.Vector ; 20 21 31 32 public final class RelayPath 33 { 34 Vector _path; 35 String _emailAddress; 36 37 43 public RelayPath(String emailAddress) 44 { 45 _path = new Vector (); 46 _emailAddress = emailAddress; 47 } 48 49 61 public void addRelay(String hostname) 62 { 63 _path.addElement(hostname); 64 } 65 66 71 public String toString() 72 { 73 StringBuffer buffer = new StringBuffer (); 74 Enumeration hosts; 75 76 buffer.append('<'); 77 78 hosts = _path.elements(); 79 80 if (hosts.hasMoreElements()) 81 { 82 buffer.append('@'); 83 buffer.append((String )hosts.nextElement()); 84 85 while (hosts.hasMoreElements()) 86 { 87 buffer.append(",@"); 88 buffer.append((String )hosts.nextElement()); 89 } 90 buffer.append(':'); 91 } 92 93 buffer.append(_emailAddress); 94 buffer.append('>'); 95 96 return buffer.toString(); 97 } 98 99 } 100 | Popular Tags |