|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.grizzly.PortRange
public class PortRange
Immutable class representing a port range.
| Constructor Summary | |
|---|---|
PortRange(int port)
Creates a port range containing a single port. |
|
PortRange(int low,
int high)
Creates a port range with the given bounds (both inclusive). |
|
| Method Summary | |
|---|---|
void |
bind(DatagramSocket socket)
Binds socket to the wildcard
|
void |
bind(DatagramSocket socket,
InetAddress address)
Binds socket to |
void |
bind(ServerSocket socket,
InetAddress address,
int backLog)
Binds socket to |
void |
bind(ServerSocket socket,
InetSocketAddress endpoint,
int backLog)
Binds socket to |
void |
bind(ServerSocket socket,
int backLog)
Binds socket to the wildcard
|
void |
bind(Socket socket)
Binds socket to the wildcard
|
void |
bind(Socket socket,
InetAddress address)
Binds socket to |
void |
bind(Socket socket,
InetSocketAddress endpoint)
Binds socket to |
int |
getLower()
|
int |
getUpper()
|
int |
random()
Returns a random port within the range. |
int |
succ(int port)
Returns the successor of a port within the range, wrapping around to the lowest port if necessary. |
String |
toString()
|
static PortRange |
valueOf(String s)
Parse a port range. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PortRange(int low,
int high)
IllegalArgumentException - is either bound is not between
0 and 65535, or if high is lower than
low.public PortRange(int port)
| Method Detail |
|---|
public static PortRange valueOf(String s)
throws IllegalArgumentException
s. Returns
the range [0,0] if s is null or empty.
IllegalArgumentExceptionpublic int random()
public int succ(int port)
public int getLower()
public int getUpper()
public void bind(ServerSocket socket,
InetSocketAddress endpoint,
int backLog)
throws IOException
socket to endpoint. If the
port in endpoint is zero, then a port is chosen
from this port range. If the port range is [0,0], then a free
port is chosen by the OS.
- Throws:
IOException - if the bind operation fails, or if the
socket is already bound.
public void bind(Socket socket,
InetSocketAddress endpoint)
throws IOException
socket to endpoint. If the
port in endpoint is zero, then a port is chosen
from this port range. If the port range is [0,0], then a free
port is chosen by the OS.
- Throws:
IOException - if the bind operation fails, or if the
socket is already bound.
public void bind(ServerSocket socket,
InetAddress address,
int backLog)
throws IOException
socket to address. A port is
chosen from this port range. If the port range is [0,0], then a
free port is chosen by the OS.
- Throws:
IOException - if the bind operation fails, or if the
socket is already bound.
public void bind(Socket socket,
InetAddress address)
throws IOException
socket to address. A port is
chosen from this port range. If the port range is [0,0], then a
free port is chosen by the OS.
- Throws:
IOException - if the bind operation fails, or if the
socket is already bound.
public void bind(DatagramSocket socket,
InetAddress address)
throws IOException
socket to address. A port is
chosen from this port range. If the port range is [0,0], then a
free port is chosen by the OS.
- Throws:
IOException - if the bind operation fails, or if the
socket is already bound.
public void bind(DatagramSocket socket)
throws IOException
socket to the wildcard
address. A port is chosen from this port range. If
the port range is [0,0], then a free port is chosen by the OS.
- Throws:
IOException - if the bind operation fails, or if the
socket is already bound.
public void bind(ServerSocket socket,
int backLog)
throws IOException
socket to the wildcard
address. A port is chosen from this port range. If
the port range is [0,0], then a free port is chosen by the OS.
- Throws:
IOException - if the bind operation fails, or if the
socket is already bound.
public void bind(Socket socket)
throws IOException
socket to the wildcard
address. A port is chosen from this port range. If
the port range is [0,0], then a free port is chosen by the OS.
- Throws:
IOException - if the bind operation fails, or if the
socket is already bound.
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||