public class IPv4AddressSection extends IPAddressSection
Modifier and Type | Class and Description |
---|---|
static class |
IPv4AddressSection.IPv4StringBuilderOptions |
IPAddressSection.IPStringBuilderOptions, IPAddressSection.StringOptions, IPAddressSection.WildcardOptions
IPAddressSegmentGrouping.Range, IPAddressSegmentGrouping.RangeList
Constructor and Description |
---|
IPv4AddressSection(byte[] bytes) |
IPv4AddressSection(byte[] bytes,
java.lang.Integer prefix) |
IPv4AddressSection(IPv4AddressSegment[] segments) |
IPv4AddressSection(IPv4AddressSegment[] segments,
java.lang.Integer networkPrefixLength) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(IPAddressSection other) |
boolean |
equals(java.lang.Object o) |
int |
getBitsPerSegment() |
int |
getByteIndex(java.lang.Integer networkPrefixLength) |
int |
getBytesPerSegment() |
IPv4AddressSection |
getHostSection(int networkPrefixLength) |
IPAddress.IPVersion |
getIPVersion() |
IPv4AddressSection |
getLowerSection()
If this represents an address section with ranging values, returns an address section representing the lower values of the range
If this represents an address section with a single value in each segment, returns this.
|
IPv4AddressSegment[] |
getLowerSegments()
If this represents an address section with ranging values, returns an array of address segments representing the lower values of the range
If this represents an address section with a single value in each segment, returns an array containing the segments for this section.
|
IPv4AddressNetwork |
getNetwork() |
IPv4AddressSection |
getNetworkSection(int networkPrefixLength) |
IPv4AddressSection |
getNetworkSection(int networkPrefixLength,
boolean withPrefixLength) |
IPAddressPart[] |
getParts(IPAddressSection.IPStringBuilderOptions options)
Get all representations of this address including this IPAddressSection.
|
IPAddressPart[] |
getParts(IPv4AddressSection.IPv4StringBuilderOptions options) |
IPv4AddressSegment |
getSegment(int index) |
int |
getSegmentIndex(java.lang.Integer networkPrefixLength) |
IPv4AddressSegment[] |
getSegments() |
IPv4AddressSection |
getUpperSection()
If this represents an address section with ranging values, returns an address section representing the upper values of the range
If this represents an address section with a single value in each segment, returns this.
|
IPv4AddressSegment[] |
getUpperSegments()
If this represents an address section with ranging values, returns an an array of address segments representing the upper values of the rang
If this represents an address section with a single value in each segment, returns an array containing the segments for this section.
|
boolean |
isIPv4() |
java.util.Iterator<IPv4AddressSegment[]> |
iterator() |
java.util.Iterator<IPv4AddressSection> |
sectionIterator() |
IPv4AddressSection[] |
subtract(IPAddressSection other)
Subtract the give subnet from this subnet, returning an array of sections for the result (the subnets will not be contiguous so an array is required).
|
IPAddressPartStringCollection |
toAllStringCollection()
Use this method with care...
|
java.lang.String |
toCanonicalString()
This produces a canonical string.
|
java.lang.String |
toCanonicalWildcardString()
This produces a string similar to the canonical string and avoids the CIDR prefix.
|
java.lang.String |
toCompressedString()
The shortest string for IPv4 addresses is the same as the canonical string.
|
java.lang.String |
toCompressedWildcardString()
This is similar to toNormalizedWildcardString, avoiding the CIDR prefix, but with compression as well.
|
IPAddressPartStringCollection |
toDatabaseSearchStringCollection()
Returns a set of strings for search the standard string representations in a database
-compress the largest compressible segments or no compression (a:0:0:c:d:0:e:f or a::c:d:0:e:f)
-upper/lowercase is not considered because many databases are case-insensitive
|
java.lang.String |
toFullString()
This produces a string with no compressed segments and all segments of full length,
which is 3 characters for IPv4 segments.
|
java.lang.String |
toInetAtonString(IPv4Address.inet_aton_radix radix) |
java.lang.String |
toInetAtonString(IPv4Address.inet_aton_radix radix,
int joinedCount) |
IPAddressSegmentGrouping |
toJoinedSegments(int joinCount) |
java.lang.String |
toNetworkPrefixLengthString()
Returns a string with a CIDR prefix length if this section has a network prefix length.
|
java.lang.String |
toNormalizedString()
The normalized string returned by this method is consistent with java.net.Inet4Address,
and is the same as the canonical string.
|
java.lang.String |
toNormalizedString(IPAddressSection.StringOptions stringParams,
int joinCount) |
java.lang.String |
toNormalizedWildcardString()
This produces a string similar to the normalized string and avoids the CIDR prefix.
|
java.lang.String |
toSQLWildcardString()
This is the same as the string from toNormalizedWildcardString except that:
-it uses IPAddress.SEGMENT_SQL_WILDCARD instead of IPAddress.SEGMENT_WILDCARD
-it uses IPAddress.SEGMENT_SQL_SINGLE_WILDCARD
|
IPAddressPartStringCollection |
toStandardStringCollection()
Returns at most a couple dozen string representations:
-mixed (1:2:3:4:5:6:1.2.3.4)
-upper and lower case
-full compressions or no compression (a:0:0:c:d:0:e:f or a::c:d:0:e:f or a:0:b:c:d::e:f)
-full leading zeros (000a:0000:000b:000c:000d:0000:000e:000f)
-combinations thereof
|
IPAddressPartStringCollection |
toStringCollection(IPAddressSection.IPStringBuilderOptions opts) |
IPAddressPartStringCollection |
toStringCollection(IPv4AddressSection.IPv4StringBuilderOptions opts) |
IPv4AddressSection |
toSubnet(int networkPrefixLength)
Creates a subnet address using the given CIDR prefix bits.
|
IPv4AddressSection |
toSubnet(IPAddressSection mask)
Creates a subnet address using the given mask.
|
IPv4AddressSection |
toSubnet(IPAddressSection mask,
java.lang.Integer networkPrefixLength)
Creates a subnet address using the given mask and prefix length.
|
java.lang.String |
toSubnetString()
Produces a consistent subnet string.
|
bitsPerSegment, bytesPerSegment, copySegments, getBitCount, getByteCount, getBytes, getEquivalentPrefix, getHostBits, getLowestBytes, getMaskPrefixLength, getMinPrefix, getSegmentCount, getSegmentPrefixLength, getSegmentPrefixLength, getSegmentStrings, getStartsWithSQLClause, getStartsWithSQLClause, isContainedBy, isDecimalSameAsOctal, isEntireAddress, isIPv6, isMaskCompatibleWithRange, toHexString, toMinimalPrefixed, toNormalizedString, toNormalizedString, toPrefixedEquivalent, toString, toSupernet, toSupernet
compareTo, getCount, getDivision, getDivisionCount, getNetworkPrefixLength, getZeroRangeSegments, getZeroSegments, hashCode, isMultiple, isMultipleByNetworkPrefix, isPrefixed, isRangeEquivalentToPrefix, isZero
getPrefixStringLength
public IPv4AddressSection(IPv4AddressSegment[] segments, java.lang.Integer networkPrefixLength)
public IPv4AddressSection(IPv4AddressSegment[] segments)
public IPv4AddressSection(byte[] bytes, java.lang.Integer prefix)
public IPv4AddressSection(byte[] bytes)
public IPv4AddressSegment[] getSegments()
getSegments
in class IPAddressSection
public IPv4AddressSegment[] getLowerSegments()
IPAddressSection
getLowerSegments
in class IPAddressSection
public IPv4AddressSegment[] getUpperSegments()
IPAddressSection
getUpperSegments
in class IPAddressSection
public IPv4AddressSection getLowerSection()
IPAddressSection
getLowerSection
in class IPAddressSection
public IPv4AddressSection getUpperSection()
IPAddressSection
getUpperSection
in class IPAddressSection
public java.util.Iterator<IPv4AddressSection> sectionIterator()
sectionIterator
in class IPAddressSection
public java.util.Iterator<IPv4AddressSegment[]> iterator()
iterator
in class IPAddressSection
public IPv4AddressSegment getSegment(int index)
getSegment
in class IPAddressSection
public int getBitsPerSegment()
getBitsPerSegment
in class IPAddressSection
public int getBytesPerSegment()
getBytesPerSegment
in class IPAddressSection
public boolean isIPv4()
isIPv4
in class IPAddressSection
public IPAddress.IPVersion getIPVersion()
getIPVersion
in class IPAddressSection
public boolean equals(java.lang.Object o)
equals
in class IPAddressSegmentGrouping
public boolean contains(IPAddressSection other)
contains
in class IPAddressSection
public IPv4AddressSection[] subtract(IPAddressSection other)
IPAddressSection
subtract
in class IPAddressSection
public int getByteIndex(java.lang.Integer networkPrefixLength)
getByteIndex
in class IPAddressSection
public int getSegmentIndex(java.lang.Integer networkPrefixLength)
getSegmentIndex
in class IPAddressSection
public IPv4AddressNetwork getNetwork()
getNetwork
in class IPAddressSection
public IPv4AddressSection toSubnet(int networkPrefixLength) throws IPAddressTypeException
IPAddressSection
toSubnet
in class IPAddressSection
IPAddressTypeException
public IPv4AddressSection toSubnet(IPAddressSection mask) throws IPAddressTypeException
toSubnet
in class IPAddressSection
IPAddressTypeException
public IPv4AddressSection toSubnet(IPAddressSection mask, java.lang.Integer networkPrefixLength) throws IPAddressTypeException
toSubnet
in class IPAddressSection
networkPrefixLength
- if non-null, applies the given prefixIPAddressTypeException
- if the mask is not compatible, see IPAddress.isMaskCompatibleWithRange(IPAddress, Integer)
public IPv4AddressSection getNetworkSection(int networkPrefixLength)
getNetworkSection
in class IPAddressSection
public IPv4AddressSection getNetworkSection(int networkPrefixLength, boolean withPrefixLength)
getNetworkSection
in class IPAddressSection
public IPv4AddressSection getHostSection(int networkPrefixLength)
getHostSection
in class IPAddressSection
public java.lang.String toCanonicalString()
toCanonicalString
in class IPAddressSection
public java.lang.String toFullString()
toFullString
in class IPAddressSection
public java.lang.String toCompressedString()
toCompressedString
in class IPAddressSection
public java.lang.String toNormalizedString()
toNormalizedString
in class IPAddressSection
public java.lang.String toCompressedWildcardString()
IPAddressSection
toCompressedWildcardString
in class IPAddressSection
public java.lang.String toSubnetString()
IPAddressSection
toSubnetString
in class IPAddressSection
public java.lang.String toNetworkPrefixLengthString()
IPAddressSection
toNetworkPrefixLengthString
in class IPAddressSection
public java.lang.String toInetAtonString(IPv4Address.inet_aton_radix radix)
public java.lang.String toInetAtonString(IPv4Address.inet_aton_radix radix, int joinedCount)
public java.lang.String toNormalizedWildcardString()
IPAddressSection
toNormalizedWildcardString
in class IPAddressSection
public java.lang.String toCanonicalWildcardString()
IPAddressSection
toCanonicalWildcardString
in class IPAddressSection
public java.lang.String toSQLWildcardString()
IPAddressSection
toSQLWildcardString
in class IPAddressSection
public java.lang.String toNormalizedString(IPAddressSection.StringOptions stringParams, int joinCount)
public IPAddressSegmentGrouping toJoinedSegments(int joinCount)
public IPAddressPartStringCollection toAllStringCollection()
IPAddressSection
toAllStringCollection
in class IPAddressSection
public IPAddressPartStringCollection toStandardStringCollection()
IPAddressSection
toStandardStringCollection
in class IPAddressSection
public IPAddressPartStringCollection toDatabaseSearchStringCollection()
IPAddressSection
toDatabaseSearchStringCollection
in class IPAddressSection
public IPAddressPartStringCollection toStringCollection(IPAddressSection.IPStringBuilderOptions opts)
toStringCollection
in class IPAddressSection
public IPAddressPartStringCollection toStringCollection(IPv4AddressSection.IPv4StringBuilderOptions opts)
public IPAddressPart[] getParts(IPAddressSection.IPStringBuilderOptions options)
IPAddressSection
getParts
in class IPAddressSection
public IPAddressPart[] getParts(IPv4AddressSection.IPv4StringBuilderOptions options)