org.glassfish.grizzly
Class PortRange

java.lang.Object
  extended by org.glassfish.grizzly.PortRange

public class PortRange
extends java.lang.Object

Immutable class representing a port range.

Author:
Gerd Behrmann, Tigran Mkrtchyan

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
 int getLower()
           
 int getUpper()
           
 java.lang.String toString()
           
static PortRange valueOf(java.lang.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

PortRange

public PortRange(int low,
                 int high)
Creates a port range with the given bounds (both inclusive).

Throws:
java.lang.IllegalArgumentException - is either bound is not between 1 and 65535, or if high is lower than low.

PortRange

public PortRange(int port)
Creates a port range containing a single port.

Method Detail

valueOf

public static PortRange valueOf(java.lang.String s)
                         throws java.lang.IllegalArgumentException
Parse a port range. A port range consists of either a single integer, or two integers separated by either a comma or a colon. The bounds must be between 1 and 65535, both inclusive.

Returns:
The port range represented by s.
Throws:
java.lang.IllegalArgumentException

getLower

public int getLower()

getUpper

public int getUpper()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2011 Oracle Corpration. All Rights Reserved.