HostnamePort (Neo4j Community 2.1.0-M01 API)
Date: 2014-02-20

org.neo4j.helpers

## Class HostnamePort

- java.lang.Object
- - org.neo4j.helpers.HostnamePort

-     public class HostnamePort
      extends Object

  Represents a hostname and port, optionally with a port range. Examples: myhost, myhost:1234, myhost:1234-1240, :1234, :1234-1240

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HostnamePort(String hostnamePort)`
    `HostnamePort(String host, int port)`
    `HostnamePort(String host, int portFrom, int portTo)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getHost()` The host part, or null if not given.
    `String` | `getHost(String defaultHost)`
    `int` | `getPort()` The first port, or 0 if no port was given.
    `int[]` | `getPorts()` The port range as two ints.
    `boolean` | `isRange()`
    `boolean` | `matches(URI toMatch)`
    `String` | `toString()`
    `String` | `toString(String defaultHost)`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### HostnamePort

          public HostnamePort(String hostnamePort)
                       throws IllegalArgumentException

      Throws:
        `IllegalArgumentException`

    - #### HostnamePort

          public HostnamePort(String host,
                      int port)

    - #### HostnamePort

          public HostnamePort(String host,
                      int portFrom,
                      int portTo)

  - ### Method Detail

    - #### getHost

          public String getHost()

      The host part, or null if not given.
      Returns:

    - #### getHost

          public String getHost(String defaultHost)

    - #### getPorts

          public int[] getPorts()

      The port range as two ints. If only one port given, then both ints have the same value. If no port range is given, then the array has {0,0} as value.
      Returns:

    - #### getPort

          public int getPort()

      The first port, or 0 if no port was given.
      Returns:

    - #### isRange

          public boolean isRange()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### toString

          public String toString(String defaultHost)

    - #### matches

          public boolean matches(URI toMatch)

Copyright © 2002–2014 The Neo4j Graph Database Project. All rights reserved.