public class Port
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other) |
int |
getPort()
Gets the port number.
|
java.lang.String |
getProtocol()
Gets the protocol.
|
int |
hashCode() |
static Port |
parseProtocol(int port,
java.lang.String protocolString)
Gets a
Port with protocol parsed from the string form protocolString . |
static Port |
tcp(int port)
Create a new
Port with TCP protocol. |
java.lang.String |
toString()
Stringifies the port with protocol, in the form
<port>/<protocol> . |
static Port |
udp(int port)
Create a new
Port with UDP protocol. |
public static Port tcp(int port)
Port
with TCP protocol.port
- the port numberPort
public static Port udp(int port)
Port
with UDP protocol.port
- the port numberPort
public static Port parseProtocol(int port, java.lang.String protocolString)
Port
with protocol parsed from the string form protocolString
. Unknown
protocols will default to TCP.port
- the port numberprotocolString
- the case insensitive string (e.g. "tcp", "udp")Port
public int getPort()
public java.lang.String getProtocol()
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
<port>/<protocol>
. For example: 1337/TCP
.toString
in class java.lang.Object