- java.lang.Object
-
- net.sourceforge.urin.Port
-
public final class Port extends java.lang.ObjectA non-negative integer port. Immutable and thread safe.- See Also:
- RFC 3986 - Port
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object object)inthashCode()static Portport(int port)Factory method for creating ports from non-negativeints.static Portport(java.lang.String port)Factory method for creating ports fromStringrepresentations of non-negative integers.java.lang.StringtoString()
-
-
-
Method Detail
-
port
public static Port port(int port)
Factory method for creating ports from non-negativeints. Note that RFC 3986 permits any non-negative integer here, but this method limits you to integers up tojava.lang.Integer.MAX_VALUE. For integers greater than this, usePort(String).- Parameters:
port- a non-negativeint.- Returns:
- a
Portrepresenting the givenint. - Throws:
java.lang.IllegalArgumentException- if the givenintis negative.
-
port
public static Port port(java.lang.String port)
Factory method for creating ports fromStringrepresentations of non-negative integers. This meansStrings consisting solely of digits in the range 0-9.- Parameters:
port- aStringconsisting solely of digits in the range 0-9.- Returns:
- a Port representing the given
String. - Throws:
java.lang.IllegalArgumentException- if the givenStringcontains characters outside the range 0-9.
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-