Class Host

  • Direct Known Subclasses:
    Uri.Host

    public abstract class Host
    extends java.lang.Object
    Represents a host in a URI or a Host header. The host can either be empty or be represented by an IPv4 or IPv6 address or by a host name.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Host EMPTY
      The constant representing an empty Host.
    • Constructor Summary

      Constructors 
      Constructor Description
      Host()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract java.lang.String address()
      Returns a String representation of the address.
      static Host create​(java.lang.String string)
      Parse the given Host string using the default charset and parsing-mode.
      static Host create​(java.lang.String string, Uri.ParsingMode parsingMode)
      Parse the given Host string using the given charset and the default parsing-mode.
      static Host create​(java.lang.String string, java.nio.charset.Charset charset, Uri.ParsingMode parsingMode)
      Parse the given Host string using the given charset and parsing-mode.
      abstract java.lang.Iterable<java.net.InetAddress> getInetAddresses()
      Returns an Iterable of InetAddresses represented by this Host.
      abstract boolean isEmpty()  
      abstract boolean isIPv4()  
      abstract boolean isIPv6()  
      abstract boolean isNamedHost()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EMPTY

        public static final Host EMPTY
        The constant representing an empty Host.
    • Constructor Detail

      • Host

        public Host()
    • Method Detail

      • address

        public abstract java.lang.String address()
        Returns a String representation of the address.
      • isEmpty

        public abstract boolean isEmpty()
      • isIPv4

        public abstract boolean isIPv4()
      • isIPv6

        public abstract boolean isIPv6()
      • isNamedHost

        public abstract boolean isNamedHost()
      • getInetAddresses

        public abstract java.lang.Iterable<java.net.InetAddress> getInetAddresses()
        Returns an Iterable of InetAddresses represented by this Host. If this Host is empty the returned Iterable will be empty. If this is an IP address the Iterable will contain this address. If this Host is represented by a host name, the name will be looked up and return all found addresses for this name.
      • create

        public static Host create​(java.lang.String string)
        Parse the given Host string using the default charset and parsing-mode.
      • create

        public static Host create​(java.lang.String string,
                                  Uri.ParsingMode parsingMode)
        Parse the given Host string using the given charset and the default parsing-mode.
      • create

        public static Host create​(java.lang.String string,
                                  java.nio.charset.Charset charset,
                                  Uri.ParsingMode parsingMode)
        Parse the given Host string using the given charset and parsing-mode.