- java.lang.Object
-
- javax.mail.Address
-
- javax.mail.internet.NewsAddress
-
- All Implemented Interfaces:
- Serializable
public class NewsAddress extends Address
This class models an RFC1036 newsgroup address.- Author:
- Bill Shannon, John Mani
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description protected String
host
protected String
newsgroup
-
Constructor Summary
Constructors Constructor and Description NewsAddress()
Default constructor.NewsAddress(String newsgroup)
Construct a NewsAddress with the given newsgroup.NewsAddress(String newsgroup, String host)
Construct a NewsAddress with the given newsgroup and host.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description boolean
equals(Object a)
The equality operator.String
getHost()
Get the host.String
getNewsgroup()
Get the newsgroup.String
getType()
Return the type of this address.int
hashCode()
Compute a hash code for the address.static NewsAddress[]
parse(String newsgroups)
Parse the given comma separated sequence of newsgroup into NewsAddress objects.void
setHost(String host)
Set the host.void
setNewsgroup(String newsgroup)
Set the newsgroup.String
toString()
Convert this address into a RFC 1036 address.static String
toString(Address[] addresses)
Convert the given array of NewsAddress objects into a comma separated sequence of address strings.
-
-
-
Constructor Detail
-
NewsAddress
public NewsAddress()
Default constructor.
-
NewsAddress
public NewsAddress(String newsgroup)
Construct a NewsAddress with the given newsgroup.- Parameters:
newsgroup
- the newsgroup
-
-
Method Detail
-
getType
public String getType()
Return the type of this address. The type of a NewsAddress is "news".- Specified by:
getType
in classAddress
- Returns:
- address type
- See Also:
InternetAddress
-
setNewsgroup
public void setNewsgroup(String newsgroup)
Set the newsgroup.- Parameters:
newsgroup
- the newsgroup
-
getNewsgroup
public String getNewsgroup()
Get the newsgroup.- Returns:
- newsgroup
-
setHost
public void setHost(String host)
Set the host.- Parameters:
host
- the host
-
getHost
public String getHost()
Get the host.- Returns:
- host
-
toString
public String toString()
Convert this address into a RFC 1036 address.
-
equals
public boolean equals(Object a)
The equality operator.
-
hashCode
public int hashCode()
Compute a hash code for the address.
-
toString
public static String toString(Address[] addresses)
Convert the given array of NewsAddress objects into a comma separated sequence of address strings. The resulting string contains only US-ASCII characters, and hence is mail-safe.- Parameters:
addresses
- array of NewsAddress objects- Returns:
- comma separated address strings
- Throws:
ClassCastException,
- if any address object in the given array is not a NewsAddress objects. Note that this is a RuntimeException.
-
parse
public static NewsAddress[] parse(String newsgroups) throws AddressException
Parse the given comma separated sequence of newsgroup into NewsAddress objects.- Parameters:
newsgroups
- comma separated newsgroup string- Returns:
- array of NewsAddress objects
- Throws:
AddressException
- if the parse failed
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
21/08/2025 16:52:22 Cette version de la page est en cache (à la date du 21/08/2025 16:52:22) afin d'accélérer le traitement.Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.
Document créé le 19/04/2008, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/mail/internet/NewsAddress.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.