Class UniAddress
- java.lang.Object
-
- jcifs.smb1.UniAddress
-
public class UniAddress extends Object
Under normal conditions it is not necessary to use this class to use jCIFS properly. Name resolusion is handled internally to the
jcifs.smb1.smb1
package.This class is a wrapper for both
NbtAddress
andInetAddress
. 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 thejcifs.smb1.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 Description UniAddress(Object addr)
Create a UniAddress by wrapping an InetAddress or NbtAddress.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Compare two addresses for equality.String
firstCalledName()
Guess first called name to try for session establishment.Object
getAddress()
Return the underlying NbtAddress or InetAddress.static UniAddress[]
getAllByName(String hostname, boolean possibleNTDomainOrWorkgroup)
static UniAddress
getByName(String hostname)
Determines the address of a host given it's host name.static UniAddress
getByName(String hostname, boolean possibleNTDomainOrWorkgroup)
Lookup hostname and return it's UniAddress.String
getHostAddress()
Return the IP address as text such as "192.168.1.15".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.String
nextCalledName()
Guess next called name to try for session establishment.String
toString()
Return the a text representation of this address such as MYCOMPUTER/192.168.1.15.
-
-
-
Constructor Detail
-
UniAddress
public UniAddress(Object addr)
Create a UniAddress by wrapping an InetAddress or NbtAddress.
-
-
Method Detail
-
getByName
public static UniAddress getByName(String hostname) throws 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:
UnknownHostException
- if there is an error resolving the name
-
getByName
public static UniAddress getByName(String hostname, boolean possibleNTDomainOrWorkgroup) throws 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:
UnknownHostException
-
getAllByName
public static UniAddress[] getAllByName(String hostname, boolean possibleNTDomainOrWorkgroup) throws UnknownHostException
- Throws:
UnknownHostException
-
hashCode
public int hashCode()
Return the IP address of this address as a 32 bit integer.
-
equals
public boolean equals(Object obj)
Compare two addresses for equality. Two UniAddresss are equal if they are both UniAddress' and refer to the same IP address.
-
firstCalledName
public String firstCalledName()
Guess first called name to try for session establishment. This method is used exclusively by the jcifs.smb1.smb1 package.
-
nextCalledName
public String nextCalledName()
Guess next called name to try for session establishment. This method is used exclusively by the jcifs.smb1.smb1 package.
-
getAddress
public Object getAddress()
Return the underlying NbtAddress or InetAddress.
-
getHostName
public String getHostName()
Return the hostname of this address such as "MYCOMPUTER".
-
getHostAddress
public String getHostAddress()
Return the IP address as text such as "192.168.1.15".
-
-