com.atlassian.crowd.model.application
Class RemoteAddress

java.lang.Object
  extended by com.atlassian.crowd.model.application.RemoteAddress
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<RemoteAddress>

public class RemoteAddress
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable<RemoteAddress>

Represents a valid IP address (IPv4, IPv6) or hostname for an Application

See Also:
Serialized Form

Constructor Summary
RemoteAddress(java.lang.String address)
          Generates a RemoteAddress based on the value provided
 
Method Summary
 int compareTo(RemoteAddress o)
           
 boolean equals(java.lang.Object o)
           
 java.lang.String getAddress()
          Returns the address.
 byte[] getAddressBytes()
          Returns the IP address in bytes array (1 byte per octet), or null if the address is a hostname.
 java.lang.String getEncodedAddressBytes()
          Returns the IP address bytes as a Base64 encoded string.
 int getMask()
          Returns the mask length in bits.
 int hashCode()
           
 boolean isHostName()
          Returns true if the address is a hostname.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteAddress

public RemoteAddress(java.lang.String address)
Generates a RemoteAddress based on the value provided

Parameters:
address - can be either a hostname or IP address (IPv4 or IPv6) An IPv4, IPv6 address can also have a mask defined in CIDR format Any input that is not recognised as IPv4 or IPv6 format will be treated as a hostname.
Method Detail

getAddress

public java.lang.String getAddress()
Returns the address. The address could be a hostname, IPv4, IPv6 address or an IP address with a mask defined in CIDR format.

Returns:
address

getAddressBytes

public byte[] getAddressBytes()
Returns the IP address in bytes array (1 byte per octet), or null if the address is a hostname.

Returns:
IP address in bytes, or null if the address is a hostname

isHostName

public boolean isHostName()
Returns true if the address is a hostname. An address is treated as a hostname if it is not a valid IP address.

Returns:
true if the address is a hostname

getMask

public int getMask()
Returns the mask length in bits.

Returns:
mask length in bits

getEncodedAddressBytes

public java.lang.String getEncodedAddressBytes()
Returns the IP address bytes as a Base64 encoded string.

Returns:
the IP address bytes as a Base64 encoded string

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(RemoteAddress o)
Specified by:
compareTo in interface java.lang.Comparable<RemoteAddress>


Copyright © 2011 Atlassian. All Rights Reserved.