Methods Summary |
---|
public java.lang.Object | clone()Makes a copy of the current instance.
HostPort retval = new HostPort();
if (this.host != null) retval.host = (Host)this.host.clone();
if (this.port != null) retval.port = new Integer
(this.port.intValue());
return retval;
|
public java.lang.String | encode()Encodes this hostport into its string representation.
Note that this could be different from the string that has
been parsed if something has been edited.
StringBuffer retval = new StringBuffer();
if (host != null)
retval.append(host.encode());
if (port != null)
retval.append(':").append(port.toString());
return retval.toString();
|
public boolean | equals(java.lang.Object other)Returns true if the two objects are equals, false otherwise.
if (! this.getClass().equals(other.getClass())) {
return false;
}
HostPort that = (HostPort) other;
if ((this.port == null && that.port != null) ||
(this.port != null && that.port == null))
return false;
else if (this.port == that.port && this.host.equals(that.host))
return true;
else
return this.host.equals(that.host) && this.port.equals(that.port);
|
public Host | getHost()Gets the Host field.
return host;
|
public int | getPort()Gets the port field.
if (port == null) {
return -1;
} else {
return port.intValue();
}
|
public boolean | hasPort()Returns boolean value indicating if Header has port
return port != null;
|
public void | removePort()Removes the port.
port = null;
|
public void | setHost(Host h)Sets the host member.
host = h;
|
public void | setPort(int p)Sets the port member.
if (p > 65535 || p < 0) {
throw new IllegalArgumentException("Illegal port value " + p);
}
port = new Integer(p);
|