jcifs

## Class UniAddress

- java.lang.Object
- - jcifs.UniAddress

-     public class UniAddress
      extends java.lang.Object

  Under normal conditions it is not necessary to use this class to use jCIFS properly. Name resolusion is handled internally to the `jcifs.smb` package.

  This class is a wrapper for both `NbtAddress` and `InetAddress`. The name resolution mechanisms used will systematically query all available configured resolution services including WINS, broadcasts, DNS, and LMHOSTS. See Setting Name Resolution Properties and the `jcifs.resolveOrder` property. Changing jCIFS name resolution properties can greatly affect the behavior of the client and may be necessary for proper operation.

  This class should be used in favor of `InetAddress` to resolve hostnames on LANs and WANs that support a mixture of NetBIOS/WINS and DNS resolvable hosts.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `UniAddress(java.lang.Object addr)` Create a `UniAddress` by wrapping an `InetAddress` or `NbtAddress`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object obj)` Compare two addresses for equality.
    `java.lang.String` | `firstCalledName()` Guess first called name to try for session establishment.
    `java.lang.Object` | `getAddress()` Return the underlying `NbtAddress` or `InetAddress`.
    `static UniAddress[]` | `getAllByName(java.lang.String hostname, boolean possibleNTDomainOrWorkgroup)`
    `static UniAddress` | `getByName(java.lang.String hostname)` Determines the address of a host given it's host name.
    `static UniAddress` | `getByName(java.lang.String hostname, boolean possibleNTDomainOrWorkgroup)` Lookup `hostname` and return it's `UniAddress`.
    `java.lang.String` | `getHostAddress()` Return the IP address as text such as "192.168.1.15".
    `java.lang.String` | `getHostName()` Return the hostname of this address such as "MYCOMPUTER".
    `int` | `hashCode()` Return the IP address of this address as a 32 bit integer.
    `java.lang.String` | `nextCalledName()` Guess next called name to try for session establishment.
    `java.lang.String` | `toString()` Return the a text representation of this address such as `MYCOMPUTER/192.168.1.15`.

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### UniAddress

          public UniAddress(java.lang.Object addr)

      Create a `UniAddress` by wrapping an `InetAddress` or `NbtAddress`.

  - ### Method Detail

    - #### getByName

          public static UniAddress getByName(java.lang.String hostname)
                                      throws java.net.UnknownHostException

      Determines the address of a host given it's host name. The name can be a machine name like "jcifs.samba.org", or an IP address like "192.168.1.15".
      Parameters:
        `hostname` - NetBIOS or DNS hostname to resolve
      Throws:
        `java.net.UnknownHostException` - if there is an error resolving the name

    - #### getByName

          public static UniAddress getByName(java.lang.String hostname,
                             boolean possibleNTDomainOrWorkgroup)
                                      throws java.net.UnknownHostException

      Lookup `hostname` and return it's `UniAddress`. If the `possibleNTDomainOrWorkgroup` parameter is `true` an addtional name query will be performed to locate a master browser.
      Throws:
        `java.net.UnknownHostException`

    - #### getAllByName

          public static UniAddress[] getAllByName(java.lang.String hostname,
                                  boolean possibleNTDomainOrWorkgroup)
                                           throws java.net.UnknownHostException

      Throws:
        `java.net.UnknownHostException`

    - #### hashCode

          public int hashCode()

      Return the IP address of this address as a 32 bit integer.
      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Compare two addresses for equality. Two `UniAddress`s are equal if they are both `UniAddress`' and refer to the same IP address.
      Overrides:
        `equals` in class `java.lang.Object`

    - #### firstCalledName

          public java.lang.String firstCalledName()

      Guess first called name to try for session establishment. This method is used exclusively by the `jcifs.smb` package.

    - #### nextCalledName

          public java.lang.String nextCalledName()

      Guess next called name to try for session establishment. This method is used exclusively by the `jcifs.smb` package.

    - #### getAddress

          public java.lang.Object getAddress()

      Return the underlying `NbtAddress` or `InetAddress`.

    - #### getHostName

          public java.lang.String getHostName()

      Return the hostname of this address such as "MYCOMPUTER".

    - #### getHostAddress

          public java.lang.String getHostAddress()

      Return the IP address as text such as "192.168.1.15".

    - #### toString

          public java.lang.String toString()

      Return the a text representation of this address such as `MYCOMPUTER/192.168.1.15`.
      Overrides:
        `toString` in class `java.lang.Object`