javax.mail.internet

Class 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 Detail

      • newsgroup

        protected String newsgroup
    • Constructor Detail

      • NewsAddress

        public NewsAddress()
        Default constructor.
      • NewsAddress

        public NewsAddress(String newsgroup)
        Construct a NewsAddress with the given newsgroup.
        Parameters:
        newsgroup - the newsgroup
      • NewsAddress

        public NewsAddress(String newsgroup,
                           String host)
        Construct a NewsAddress with the given newsgroup and host.
        Parameters:
        newsgroup - the newsgroup
        host - the host
    • Method Detail

      • getType

        public String getType()
        Return the type of this address. The type of a NewsAddress is "news".
        Specified by:
        getType in class Address
        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.
        Specified by:
        toString in class Address
        Returns:
        newsgroup
      • equals

        public boolean equals(Object a)
        The equality operator.
        Specified by:
        equals in class Address
        Parameters:
        a - Address object
      • hashCode

        public int hashCode()
        Compute a hash code for the address.
        Overrides:
        hashCode in class Object
      • 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

Document created the 11/06/2005, last modified the 18/08/2025
Source of the printed document:https://www.gaudry.be/en/java-api-javaee-rf-javax/mail/internet/NewsAddress.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : https://docs.oracle.com, NewsAddress (Java(TM) EE 7 Specification APIs)

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author of this site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.