Package jcifs.netbios
Class UniAddress
- java.lang.Object
-
- jcifs.netbios.UniAddress
-
- All Implemented Interfaces:
Address
public class UniAddress extends Object implements Address
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
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.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.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.static boolean
isDotQuadIP(String hostname)
Check whether a hostname is actually an ip addressString
nextCalledName(CIFSContext tc)
Guess next called name to try for session establishment.InetAddress
toInetAddress()
String
toString()
Return the a text representation of this address such as MYCOMPUTER/192.168.1.15.<T extends Address>
Tunwrap(Class<T> type)
-
-
-
Constructor Detail
-
UniAddress
public UniAddress(Object addr)
Create a UniAddress by wrapping an InetAddress or NbtAddress.- Parameters:
addr
- wrapped address
-
-
Method Detail
-
isDotQuadIP
public static boolean isDotQuadIP(String hostname)
Check whether a hostname is actually an ip address- Parameters:
hostname
-- Returns:
- whether this is an IP address
-
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.smb package.- Specified by:
firstCalledName
in interfaceAddress
- Returns:
- the guessed name
-
nextCalledName
public String nextCalledName(CIFSContext tc)
Guess next called name to try for session establishment. This method is used exclusively by the jcifs.smb package.- Specified by:
nextCalledName
in interfaceAddress
- Parameters:
tc
- context to use- Returns:
- guessed alternate name
-
getAddress
public Object getAddress()
Return the underlying NbtAddress or InetAddress.- Returns:
- wrapped address
-
getHostName
public String getHostName()
Return the hostname of this address such as "MYCOMPUTER".- Specified by:
getHostName
in interfaceAddress
- Returns:
- the hostname associated with the address
-
getHostAddress
public String getHostAddress()
Return the IP address as text such as "192.168.1.15".- Specified by:
getHostAddress
in interfaceAddress
- Returns:
- the ip address
-
toInetAddress
public InetAddress toInetAddress() throws UnknownHostException
- Specified by:
toInetAddress
in interfaceAddress
- Returns:
- this address as an InetAddress
- Throws:
UnknownHostException
- See Also:
Address.toInetAddress()
-
unwrap
public <T extends Address> T unwrap(Class<T> type)
- Specified by:
unwrap
in interfaceAddress
- Returns:
- instance for type, null if the type cannot be unwrapped
- See Also:
Address.unwrap(java.lang.Class)
-
-