public class PortSpecification extends Object
TransportLayerMappingStrategy, and configured by
an instance of KrakenProtocolConfigurationBuilder resulting
in a KrakenProtocolConfiguration object.
Note, that this implementation currently utilizes the Java 8 - Stream API for performing PortRange
bound checking via predicates, see contains(Port).
Additionally, the subclass PortSpecification.UniversalPortSpecification
was defined for convenience reasons.
This class is not thread-safe.| Modifier and Type | Class and Description |
|---|---|
static class |
PortSpecification.UniversalPortSpecification
A port specification that returns either always true or always false for any given port number.
|
| Constructor and Description |
|---|
PortSpecification() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Port singlePort)
Adds a single port to this specification.
|
void |
add(PortRange portRange)
Adds a new port-range to this specification.
|
boolean |
contains(int destinationPort)
This is a convenience method for
contains(Port). |
boolean |
contains(Port destinationPort)
Performs a bound check according to the underlying specification.
|
public void add(Port singlePort)
singlePort - the port to add to this specificationIllegalArgumentException - if singlePort == nullpublic void add(PortRange portRange)
HashSet is used internally to store the port ranges.portRange - the port range to add to this specificationIllegalArgumentException - if the portRange is nullpublic boolean contains(int destinationPort)
contains(Port).
A new Port is constructed for the passed
integer argument.destinationPort - the port number to check against this specificationIllegalArgumentException - if the port number is invalidcontains(Port)public boolean contains(Port destinationPort)
Port
or any specified PortRange returns true by calling
PortRange.isWithinRange(Port).
A Java 8 predicate check via the new stream-API is currently used for this check.destinationPort - the port to check against this specificationCopyright © 2013–2015 Institute of networks and security. All rights reserved.