- java.lang.Object
-
- inet.ipaddr.format.validate.ParsedIPAddress
-
- All Implemented Interfaces:
IPAddressProvider
,java.io.Serializable
public class ParsedIPAddress extends java.lang.Object implements IPAddressProvider
The result from parsing a valid address string. This can be converted into anIPv4Address
orIPv6Address
instance.- Author:
- sfoley
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ParsedIPAddress.BitwiseOrer
static class
ParsedIPAddress.ExtendedFullRangeMasker
static class
ParsedIPAddress.ExtendedMasker
static class
ParsedIPAddress.ExtendedSpecificValueMasker
static class
ParsedIPAddress.FullRangeBitwiseOrer
static class
ParsedIPAddress.FullRangeMasker
static class
ParsedIPAddress.Masker
static class
ParsedIPAddress.SpecificValueBitwiseOrer
The analog to SpecificValueMasker for oringstatic class
ParsedIPAddress.SpecificValueMasker
When the part of a mask covering a range of values is a mix of ones and zeros, then there may be an intermediate value in the range that when masked, produces the new upper and lower values.static class
ParsedIPAddress.WrappedMasker
-
Nested classes/interfaces inherited from interface inet.ipaddr.format.validate.IPAddressProvider
IPAddressProvider.AdjustedAddressCreator, IPAddressProvider.AllCreator, IPAddressProvider.CachedAddressCreator, IPAddressProvider.CachedAddressProvider, IPAddressProvider.IPType, IPAddressProvider.LoopbackCreator, IPAddressProvider.MaskCreator, IPAddressProvider.NullProvider, IPAddressProvider.VersionedAddressCreator
-
-
Field Summary
Fields Modifier and Type Field Description static int
FLAGS_INDEX
static int
KEY_BIT_SIZE_INDEX
static int
KEY_EXTENDED_LOWER
static int
KEY_EXTENDED_UPPER
static int
KEY_INFERRED_LOWER_BOUNDARY
static int
KEY_INFERRED_UPPER_BOUNDARY
static int
KEY_LOWER
static int
KEY_LOWER_RADIX_INDEX
static int
KEY_LOWER_STR_DIGITS_INDEX
static int
KEY_LOWER_STR_END_INDEX
static int
KEY_LOWER_STR_START_INDEX
static int
KEY_MERGED_MIXED
static int
KEY_RANGE_WILDCARD
static int
KEY_SINGLE_WILDCARD
static int
KEY_STANDARD_RANGE_STR
static int
KEY_STANDARD_STR
static int
KEY_UPPER
static int
KEY_UPPER_RADIX_INDEX
static int
KEY_UPPER_STR_DIGITS_INDEX
static int
KEY_UPPER_STR_END_INDEX
static int
KEY_UPPER_STR_START_INDEX
static int
KEY_WILDCARD
-
Fields inherited from interface inet.ipaddr.format.validate.IPAddressProvider
EMPTY_PROVIDER, INVALID_PROVIDER, NO_TYPE_PROVIDER
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ParsedIPAddress.BitwiseOrer
bitwiseOrRange(long value, long upperValue, long maskValue)
static ParsedIPAddress.BitwiseOrer
bitwiseOrRange(long value, long upperValue, long maskValue, long maxValue)
java.lang.Boolean
contains(IPAddressProvider other)
An optimized contains that does not need to create address objects to return an answer.java.lang.Boolean
contains(java.lang.String other)
An optimized contains that does not need to fully parse the other address to return an answer.IPAddressDivisionSeries
getDivisionGrouping()
IPAddressStringParameters
getParameters()
If the address was created by parsing, this provides the parameters used when creating the address.IPAddress
getProviderAddress()
IPAddress
getProviderAddress(IPAddress.IPVersion version)
IPAddress
getProviderHostAddress()
IPAddress.IPVersion
getProviderIPVersion()
IPAddress
getProviderMask()
java.lang.Integer
getProviderNetworkPrefixLength()
IPAddressSeqRange
getProviderSeqRange()
int
getSegmentCount()
IPAddressProvider.IPType
getType()
boolean
hasPrefixSeparator()
boolean
isProvidingBase85IPv6()
boolean
isProvidingEmpty()
boolean
isProvidingIPAddress()
boolean
isProvidingIPv4()
boolean
isProvidingIPv6()
boolean
isProvidingMixedIPv6()
boolean
isSequential()
static ParsedIPAddress.Masker
maskRange(long value, long upperValue, long maskValue)
static ParsedIPAddress.Masker
maskRange(long value, long upperValue, long maskValue, long maxValue)
static ParsedIPAddress.ExtendedMasker
maskRange(long value, long extendedValue, long upperValue, long extendedUpperValue, long maskValue, long extendedMaskValue, long maxValue, long extendedMaxValue)
java.lang.Boolean
parsedEquals(IPAddressProvider other)
An optimized equality comparison that does not need to create addresses to return an answer.java.lang.Boolean
prefixContains(IPAddressProvider other)
An optimized prefix comparison that does not need to create addresses to return an answer.java.lang.Boolean
prefixContains(java.lang.String other)
An optimized prefix comparison that does not need to create addresses to return an answer.java.lang.Boolean
prefixEquals(IPAddressProvider other)
An optimized prefix comparison that does not need to create addresses to return an answer.java.lang.Boolean
prefixEquals(java.lang.String other)
An optimized prefix comparison that does not need to fully parse the other address to return an answer.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface inet.ipaddr.format.validate.IPAddressProvider
getProviderIPVersion, hasPrefixSeparator, isInvalid, isProvidingAllAddresses, isProvidingBase85IPv6, isProvidingEmpty, isProvidingIPv4, isProvidingIPv6, isProvidingMixedIPv6, isProvidingPrefixOnly, isUninitialized, providerCompare, providerEquals, providerHashCode
-
-
-
-
Field Detail
-
KEY_WILDCARD
public static final int KEY_WILDCARD
- See Also:
- Constant Field Values
-
KEY_SINGLE_WILDCARD
public static final int KEY_SINGLE_WILDCARD
- See Also:
- Constant Field Values
-
KEY_STANDARD_STR
public static final int KEY_STANDARD_STR
- See Also:
- Constant Field Values
-
KEY_STANDARD_RANGE_STR
public static final int KEY_STANDARD_RANGE_STR
- See Also:
- Constant Field Values
-
KEY_RANGE_WILDCARD
public static final int KEY_RANGE_WILDCARD
- See Also:
- Constant Field Values
-
KEY_INFERRED_LOWER_BOUNDARY
public static final int KEY_INFERRED_LOWER_BOUNDARY
- See Also:
- Constant Field Values
-
KEY_INFERRED_UPPER_BOUNDARY
public static final int KEY_INFERRED_UPPER_BOUNDARY
- See Also:
- Constant Field Values
-
KEY_MERGED_MIXED
public static final int KEY_MERGED_MIXED
- See Also:
- Constant Field Values
-
KEY_LOWER_RADIX_INDEX
public static final int KEY_LOWER_RADIX_INDEX
- See Also:
- Constant Field Values
-
KEY_BIT_SIZE_INDEX
public static final int KEY_BIT_SIZE_INDEX
- See Also:
- Constant Field Values
-
FLAGS_INDEX
public static final int FLAGS_INDEX
- See Also:
- Constant Field Values
-
KEY_UPPER_RADIX_INDEX
public static final int KEY_UPPER_RADIX_INDEX
- See Also:
- Constant Field Values
-
KEY_LOWER
public static final int KEY_LOWER
- See Also:
- Constant Field Values
-
KEY_EXTENDED_LOWER
public static final int KEY_EXTENDED_LOWER
- See Also:
- Constant Field Values
-
KEY_UPPER
public static final int KEY_UPPER
- See Also:
- Constant Field Values
-
KEY_EXTENDED_UPPER
public static final int KEY_EXTENDED_UPPER
- See Also:
- Constant Field Values
-
KEY_LOWER_STR_DIGITS_INDEX
public static final int KEY_LOWER_STR_DIGITS_INDEX
- See Also:
- Constant Field Values
-
KEY_LOWER_STR_START_INDEX
public static final int KEY_LOWER_STR_START_INDEX
- See Also:
- Constant Field Values
-
KEY_LOWER_STR_END_INDEX
public static final int KEY_LOWER_STR_END_INDEX
- See Also:
- Constant Field Values
-
KEY_UPPER_STR_DIGITS_INDEX
public static final int KEY_UPPER_STR_DIGITS_INDEX
- See Also:
- Constant Field Values
-
KEY_UPPER_STR_START_INDEX
public static final int KEY_UPPER_STR_START_INDEX
- See Also:
- Constant Field Values
-
KEY_UPPER_STR_END_INDEX
public static final int KEY_UPPER_STR_END_INDEX
- See Also:
- Constant Field Values
-
-
Method Detail
-
isProvidingIPAddress
public boolean isProvidingIPAddress()
- Specified by:
isProvidingIPAddress
in interfaceIPAddressProvider
-
getType
public IPAddressProvider.IPType getType()
- Specified by:
getType
in interfaceIPAddressProvider
-
getParameters
public IPAddressStringParameters getParameters()
Description copied from interface:IPAddressProvider
If the address was created by parsing, this provides the parameters used when creating the address.- Specified by:
getParameters
in interfaceIPAddressProvider
- Returns:
- the parameters used to create the address, or null if no such parameters were used.
-
getProviderSeqRange
public IPAddressSeqRange getProviderSeqRange()
- Specified by:
getProviderSeqRange
in interfaceIPAddressProvider
-
getProviderMask
public IPAddress getProviderMask()
- Specified by:
getProviderMask
in interfaceIPAddressProvider
-
getDivisionGrouping
public IPAddressDivisionSeries getDivisionGrouping() throws IncompatibleAddressException
- Specified by:
getDivisionGrouping
in interfaceIPAddressProvider
- Throws:
IncompatibleAddressException
-
maskRange
public static ParsedIPAddress.ExtendedMasker maskRange(long value, long extendedValue, long upperValue, long extendedUpperValue, long maskValue, long extendedMaskValue, long maxValue, long extendedMaxValue)
-
maskRange
public static ParsedIPAddress.Masker maskRange(long value, long upperValue, long maskValue)
- Parameters:
value
-upperValue
-maskValue
-- Returns:
- an instance what will produce the result of masking the values -1 if not compatible and x where x >= 0 if compatible. If x is 0, then the resulting masked range is (value & maskValue) to (upperValue & maskValue). If x > 0, then the resulting masked range is (value & maskValue & lowerMask) to ((upperValue & maskValue) | upperMask) where upperMask is ~0 >>> x and lowerMask = ~upperMask.
-
maskRange
public static ParsedIPAddress.Masker maskRange(long value, long upperValue, long maskValue, long maxValue)
-
bitwiseOrRange
public static ParsedIPAddress.BitwiseOrer bitwiseOrRange(long value, long upperValue, long maskValue)
-
bitwiseOrRange
public static ParsedIPAddress.BitwiseOrer bitwiseOrRange(long value, long upperValue, long maskValue, long maxValue)
-
isSequential
public boolean isSequential()
- Specified by:
isSequential
in interfaceIPAddressProvider
-
getProviderHostAddress
public IPAddress getProviderHostAddress() throws IncompatibleAddressException
- Specified by:
getProviderHostAddress
in interfaceIPAddressProvider
- Throws:
IncompatibleAddressException
-
getProviderAddress
public IPAddress getProviderAddress() throws IncompatibleAddressException
- Specified by:
getProviderAddress
in interfaceIPAddressProvider
- Throws:
IncompatibleAddressException
-
getProviderAddress
public IPAddress getProviderAddress(IPAddress.IPVersion version) throws IncompatibleAddressException
- Specified by:
getProviderAddress
in interfaceIPAddressProvider
- Throws:
IncompatibleAddressException
-
contains
public java.lang.Boolean contains(java.lang.String other)
Description copied from interface:IPAddressProvider
An optimized contains that does not need to fully parse the other address to return an answer. Unconventional addresses may require full parsing, in such cases null is returned. Addresses constructed from canonical or normalized representations with no wildcards will not return null.- Specified by:
contains
in interfaceIPAddressProvider
- Returns:
-
prefixContains
public java.lang.Boolean prefixContains(java.lang.String other)
Description copied from interface:IPAddressProvider
An optimized prefix comparison that does not need to create addresses to return an answer. Unconventional addresses may require the address objects, in such cases null is returned.- Specified by:
prefixContains
in interfaceIPAddressProvider
- Returns:
-
prefixEquals
public java.lang.Boolean prefixEquals(java.lang.String other)
Description copied from interface:IPAddressProvider
An optimized prefix comparison that does not need to fully parse the other address to return an answer. Unconventional addresses may require full parsing, in such cases null is returned. Addresses constructed from canonical or normalized representations with no wildcards will not return null.- Specified by:
prefixEquals
in interfaceIPAddressProvider
- Returns:
-
contains
public java.lang.Boolean contains(IPAddressProvider other)
Description copied from interface:IPAddressProvider
An optimized contains that does not need to create address objects to return an answer. Unconventional addresses may require that the address objects are created, in such cases null is returned. Addresses constructed from canonical or normalized representations with no wildcards will not return null.- Specified by:
contains
in interfaceIPAddressProvider
- Returns:
-
parsedEquals
public java.lang.Boolean parsedEquals(IPAddressProvider other)
Description copied from interface:IPAddressProvider
An optimized equality comparison that does not need to create addresses to return an answer. Unconventional addresses may require the address objects, in such cases null is returned.- Specified by:
parsedEquals
in interfaceIPAddressProvider
- Returns:
-
prefixContains
public java.lang.Boolean prefixContains(IPAddressProvider other)
Description copied from interface:IPAddressProvider
An optimized prefix comparison that does not need to create addresses to return an answer. Unconventional addresses may require the address objects, in such cases null is returned.- Specified by:
prefixContains
in interfaceIPAddressProvider
- Returns:
-
prefixEquals
public java.lang.Boolean prefixEquals(IPAddressProvider other)
Description copied from interface:IPAddressProvider
An optimized prefix comparison that does not need to create addresses to return an answer. Unconventional addresses may require the address objects, in such cases null is returned.- Specified by:
prefixEquals
in interfaceIPAddressProvider
- Returns:
-
getProviderNetworkPrefixLength
public java.lang.Integer getProviderNetworkPrefixLength()
- Specified by:
getProviderNetworkPrefixLength
in interfaceIPAddressProvider
-
getProviderIPVersion
public IPAddress.IPVersion getProviderIPVersion()
-
isProvidingIPv6
public boolean isProvidingIPv6()
-
isProvidingIPv4
public boolean isProvidingIPv4()
-
hasPrefixSeparator
public boolean hasPrefixSeparator()
-
isProvidingBase85IPv6
public boolean isProvidingBase85IPv6()
-
isProvidingMixedIPv6
public boolean isProvidingMixedIPv6()
-
toString
public java.lang.String toString()
-
getSegmentCount
public int getSegmentCount()
-
isProvidingEmpty
public boolean isProvidingEmpty()
-
-