public class IPv4AddressSection extends IPAddressSection implements java.lang.Iterable<IPv4AddressSection>
| Modifier and Type | Class and Description |
|---|---|
static class |
IPv4AddressSection.IPv4StringBuilderOptions |
static class |
IPv4AddressSection.IPv4StringOptions
Represents a clear way to create a specific type of string.
|
IPAddressSection.IPStringBuilderOptions, IPAddressSection.IPStringOptions, IPAddressSection.SegFunction<R,S>, IPAddressSection.WildcardOptionsIPAddressDivisionGrouping.Range, IPAddressDivisionGrouping.RangeListAddressDivisionGrouping.StringOptions| Constructor and Description |
|---|
IPv4AddressSection(Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider,
int segmentCount) |
IPv4AddressSection(Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider,
int segmentCount,
java.lang.Integer networkPrefixLength) |
IPv4AddressSection(Address.SegmentValueProvider valueProvider,
int segmentCount) |
IPv4AddressSection(Address.SegmentValueProvider valueProvider,
int segmentCount,
java.lang.Integer networkPrefixLength) |
IPv4AddressSection(byte[] bytes) |
IPv4AddressSection(byte[] bytes,
java.lang.Integer prefix) |
IPv4AddressSection(byte[] bytes,
int byteStartIndex,
int byteEndIndex) |
IPv4AddressSection(byte[] bytes,
int byteStartIndex,
int byteEndIndex,
java.lang.Integer prefix) |
IPv4AddressSection(int value) |
IPv4AddressSection(int value,
java.lang.Integer networkPrefixLength) |
IPv4AddressSection(IPv4AddressSegment segment)
Constructs a single segment section.
|
IPv4AddressSection(IPv4AddressSegment[] segments) |
IPv4AddressSection(IPv4AddressSegment[] segments,
java.lang.Integer networkPrefixLength) |
| Modifier and Type | Method and Description |
|---|---|
IPv4AddressSection |
adjustPrefixBySegment(boolean nextSegment)
Increases or decreases prefix length to the next segment boundary.
|
IPv4AddressSection |
adjustPrefixBySegment(boolean nextSegment,
boolean zeroed)
Increases or decreases prefix length to the next segment boundary.
|
IPv4AddressSection |
adjustPrefixLength(int adjustment)
Increases or decreases prefix length by the given increment.
|
IPv4AddressSection |
adjustPrefixLength(int adjustment,
boolean zeroed)
Increases or decreases prefix length by the given increment.
|
IPv4AddressSection |
append(IPv4AddressSection other) |
IPv4AddressSection |
appendToNetwork(IPv4AddressSection other) |
IPv4AddressSection |
applyPrefixLength(int networkPrefixLength)
Applies the given prefix length to create a new segment series.
|
IPv4AddressSection |
assignMinPrefixForBlock()
Constructs an equivalent address section with the smallest CIDR prefix possible (largest network),
such that the range of values are a set of subnet blocks for that prefix.
|
IPv4AddressSection |
assignPrefixForSingleBlock()
Returns the equivalent CIDR address section with a prefix length for which the subnet block for that prefix matches the range of values in this section.
|
IPv4AddressSection |
bitwiseOr(IPv4AddressSection mask)
Equivalent to
bitwiseOr(IPv4AddressSection, boolean) with the second argument as false. |
IPv4AddressSection |
bitwiseOr(IPv4AddressSection mask,
boolean retainPrefix)
Does the bitwise disjunction with this address section.
|
IPv4AddressSection |
bitwiseOrNetwork(IPv4AddressSection mask,
int networkPrefixLength)
Does the bitwise disjunction with this address section.
|
boolean |
contains(AddressSection other)
Determines if one section contains another.
|
IPv4AddressSection |
createMaxHost() |
boolean |
equals(java.lang.Object o) |
int |
getBitCount() |
int |
getBitsPerSegment()
Returns the number of bits comprising each segment in this series.
|
int |
getByteCount()
returns the number of bytes in each of the address components represented by this instance
|
int |
getBytesPerSegment()
Returns the number of bytes comprising each segment in this series.
|
IPv4AddressSegment |
getDivision(int index) |
IPv4AddressSection |
getHostSection()
Returns the host section of the series.
|
IPv4AddressSection |
getHostSection(int networkPrefixLength)
Returns the host section of the address as indicated by the network prefix length provided.
|
long |
getIPv4Count(boolean excludeZeroHosts) |
long |
getIPv4PrefixCount() |
IPAddress.IPVersion |
getIPVersion()
Returns the version of this segment series
|
java.lang.Iterable<IPv4AddressSection> |
getIterable()
Useful for using an instance in a "for-each loop".
|
IPv4AddressSection |
getLower()
If this represents a series with ranging values, returns a series representing the lower values of the range.
|
IPv4AddressSection |
getLowerNonZeroHost()
Similar to
IPAddressSegmentSeries.getLower(), but will not return a series that has a prefix length and whose host value is zero. |
IPv4AddressNetwork |
getNetwork()
Returns the network object for series of the same version (eg IPv4, IPv6 and MAC each have their own network object)
|
IPv4AddressSection |
getNetworkSection()
Returns the network section of the series if the series has a CIDR network prefix length,
otherwise it returns the entire series as a prefixed series with prefix matching the address bit length.
|
IPv4AddressSection |
getNetworkSection(int networkPrefixLength)
Returns the network section of the series.
|
IPv4AddressSection |
getNetworkSection(int networkPrefixLength,
boolean withPrefixLength)
Returns the network section of the series.
|
IPAddressStringDivisionSeries[] |
getParts(IPAddressSection.IPStringBuilderOptions options)
Get all representations of this address including this IPAddressSection.
|
IPAddressStringDivisionSeries[] |
getParts(IPv4AddressSection.IPv4StringBuilderOptions options) |
java.math.BigInteger |
getPrefixCount()
If this has a prefix length, the count of the range of values in the prefix.
|
IPv4AddressSection |
getSection()
Gets the subsection from the series that comprises all segments
|
IPv4AddressSection |
getSection(int index)
Gets the subsection from the series starting from the given index
|
IPv4AddressSection |
getSection(int index,
int endIndex)
Gets the subsection from the series starting from the given index and ending just before the give endIndex
|
IPv4AddressSegment |
getSegment(int index)
Returns the segment from this series at the given index.
|
IPv4AddressSegment[] |
getSegments()
Returns the segments of this series of segments as an array.
|
void |
getSegments(java.util.Collection<? super IPv4AddressSegment> segs) |
void |
getSegments(int start,
int end,
java.util.Collection<? super IPv4AddressSegment> segs) |
IPv4AddressSection[] |
getSpanningPrefixBlocks(IPv4AddressSection other)
Produces the list of prefix block subnets that span from this series to the given series.
|
IPv4AddressSection |
getUpper()
If this represents a series with ranging values, returns a series representing the upper values of the range
If this represents a series with a single value in each segment, returns this.
|
IPv4AddressSection |
increment(long increment)
Returns the series from the subnet that is the given increment upwards into the subnet range,
or if the given increment is negative the given increment downwards into the subnet range,
or if this is just an individual series, it simply adds the increment to this.
|
IPv4AddressSection |
insert(int index,
IPv4AddressSection other) |
IPv4AddressSection |
intersect(IPv4AddressSection other)
Produces the subnet sections whose addresses are found in both this and the given argument.
|
int |
intValue() |
boolean |
isIPv4() |
java.util.Iterator<IPv4AddressSection> |
iterator()
Iterates through the individual segment series.
|
long |
longValue() |
IPv4AddressSection |
mask(IPv4AddressSection mask)
Equivalent to
mask(IPv4AddressSection, boolean) with the second argument as false. |
IPv4AddressSection |
mask(IPv4AddressSection mask,
boolean retainPrefix)
Does the bitwise conjunction with this address.
|
IPv4AddressSection |
maskNetwork(IPv4AddressSection mask,
int networkPrefixLength)
Produces the bitwise conjunction of the given mask with the network section of the address as indicated by the given prefix length.
|
boolean |
matchesWithMask(IPAddressSection other,
IPAddressSection mask)
Applies the mask to this address section and then compares values with the given address section
|
IPv4AddressSection[] |
mergeBlocks(IPv6AddressSection... sections)
Merges this with the list of sections to produce the smallest array of prefix blocks, going from smallest to largest
|
java.util.Iterator<IPv4AddressSection> |
nonZeroHostIterator() |
java.util.Iterator<IPv4AddressSection> |
prefixBlockIterator()
Iterates through the individual prefix blocks.
|
IPv4AddressSection |
removePrefixLength()
Removes the prefix length.
|
IPv4AddressSection |
removePrefixLength(boolean zeroed)
Removes the prefix length.
|
IPv4AddressSection |
replace(int startIndex,
int endIndex,
IPv4AddressSection replacement,
int replacementStartIndex,
int replacementEndIndex)
Replaces segments starting from startIndex and ending before endIndex with the segments starting at replacementStartIndex and
ending before replacementEndIndex from the replacement section
|
IPv4AddressSection |
replace(int index,
IPv4AddressSection other)
Replace the segments of this section starting at the given index with the given replacement segments
|
IPv4AddressSection |
reverseBits(boolean perByte)
Returns a new series which has the bits reversed.
|
IPv4AddressSection |
reverseBytes()
Returns a new segment series with the bytes reversed.
|
IPv4AddressSection |
reverseBytesPerSegment()
Returns a new segment series with the bytes reversed within each segment.
|
IPv4AddressSection |
reverseSegments()
Returns a new segment series with the segments reversed.
|
java.util.Iterator<IPv4AddressSegment[]> |
segmentsIterator()
Iterates through the individual segments.
|
java.util.Iterator<IPv4AddressSegment[]> |
segmentsNonZeroHostIterator() |
IPv4AddressSection |
setPrefixLength(int networkPrefixLength)
Sets the prefix length.
|
IPv4AddressSection |
setPrefixLength(int networkPrefixLength,
boolean withZeros)
Sets the prefix length.
|
IPv4AddressSection[] |
subtract(IPv4AddressSection other)
Subtract the given 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) |
IPAddressDivisionGrouping |
toJoinedSegments(int joinCount) |
IPv4AddressSection |
toMaxHost()
Returns the segment series with a host of all ones.
|
IPv4AddressSection |
toMaxHost(int prefixLength)
Produces the series with host values of all one bits for the given prefix length.
|
java.lang.String |
toNormalizedString()
The normalized string returned by this method is consistent with java.net.Inet4Address,
and is the same as
toCanonicalString(). |
java.lang.String |
toNormalizedString(IPAddressSection.IPStringOptions stringParams,
int joinCount) |
java.lang.String |
toNormalizedWildcardString()
This produces a string similar to the normalized string and avoids the CIDR prefix.
|
IPv4AddressSection |
toPrefixBlock()
If this series has a prefix length, returns the subnet block for that prefix.
|
IPv4AddressSection |
toPrefixBlock(int networkPrefixLength)
Returns the segment series of the same length that spans all hosts.
|
java.lang.String |
toPrefixLengthString()
Returns a string with a CIDR prefix length if this section has a network prefix length.
|
java.lang.String |
toReverseDNSLookupString()
Generates the reverse DNS lookup string
For 8.255.4.4 it is 4.4.255.8.in-addr.arpa
For 2001:db8::567:89ab it is b.a.9.8.7.6.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa
|
java.lang.String |
toSQLWildcardString()
This is the same as the string from toNormalizedWildcardString except that
it uses
Address.SEGMENT_SQL_WILDCARD instead of Address.SEGMENT_WILDCARD and also uses Address.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) |
java.lang.String |
toSubnetString()
Produces a consistent subnet string.
|
IPv4AddressSection |
toZeroHost()
Returns the segment series with a host of zero.
|
IPv4AddressSection |
toZeroHost(int prefixLength)
Produces the series with host values of 0 for the given prefix length.
|
int |
upperIntValue() |
long |
upperLongValue() |
bitsPerSegment, bytesPerSegment, containsPrefixBlock, getBlockMaskPrefixLength, getCountImpl, getHostBitCount, getHostSegmentCount, getMinPrefixLengthForBlock, getNetworkSegmentCount, getNonZeroHostCount, getPrefixLengthForSingleBlock, getSegmentCount, getSegmentPrefixLength, getSegments, getSegments, getSegmentStrings, getStartsWithSQLClause, getStartsWithSQLClause, includesMaxHost, includesMaxHost, includesZeroHost, includesZeroHost, isEntireAddress, isFullRange, isIPv6, isSingleNetwork, toBinaryString, toHexString, toNormalizedString, toNormalizedString, toOctalString, toStringcontainsSinglePrefixBlock, getNetworkPrefixLength, getPrefixLength, getZeroRangeSegments, getZeroSegments, isMore, isPrefixBlock, isPrefixed, isSinglePrefixBlockcompareTo, getBytes, getBytes, getCount, getDivisionCount, getDivisionStrings, getUpperBytes, getUpperBytes, getUpperValue, getValue, hashCode, includesMax, includesZero, isMax, isMultiple, isZerogetNetworkPrefixLengthcontainsSinglePrefixBlock, getDivisionStrings, getPrefixLength, getUpperValue, getValue, isMore, isPrefixBlock, isPrefixed, isSinglePrefixBlockgetDivisionCountgetBytes, getBytes, getCount, getUpperBytes, getUpperBytes, includesMax, includesZero, isMax, isMultiple, isZeropublic IPv4AddressSection(IPv4AddressSegment segment)
segment - public IPv4AddressSection(IPv4AddressSegment[] segments) throws AddressValueException
AddressValueExceptionpublic IPv4AddressSection(IPv4AddressSegment[] segments, java.lang.Integer networkPrefixLength) throws AddressValueException
segments - an array containing the segments. Segments that are entirely part of the host section need not be provided, although the array must be the correct length.networkPrefixLength - AddressValueExceptionpublic IPv4AddressSection(Address.SegmentValueProvider valueProvider, int segmentCount, java.lang.Integer networkPrefixLength) throws AddressValueException
AddressValueExceptionpublic IPv4AddressSection(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, int segmentCount, java.lang.Integer networkPrefixLength) throws AddressValueException
AddressValueExceptionpublic IPv4AddressSection(Address.SegmentValueProvider valueProvider, int segmentCount) throws AddressValueException
AddressValueExceptionpublic IPv4AddressSection(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, int segmentCount)
public IPv4AddressSection(byte[] bytes,
java.lang.Integer prefix)
throws AddressValueException
AddressValueExceptionpublic IPv4AddressSection(byte[] bytes)
throws AddressValueException
AddressValueExceptionpublic IPv4AddressSection(byte[] bytes,
int byteStartIndex,
int byteEndIndex,
java.lang.Integer prefix)
throws AddressValueException
AddressValueExceptionpublic IPv4AddressSection(byte[] bytes,
int byteStartIndex,
int byteEndIndex)
throws AddressValueException
AddressValueExceptionpublic IPv4AddressSection(int value,
java.lang.Integer networkPrefixLength)
throws AddressValueException
AddressValueExceptionpublic IPv4AddressSection(int value)
public IPv4AddressSegment[] getSegments()
AddressSegmentSeriesAddressSegmentSeries.getSegment(int) and AddressSegmentSeries.getSegmentCount() instead when feasible.getSegments in interface AddressSegmentSeriesgetSegments in interface IPAddressSegmentSeriespublic IPv4AddressSection getSection()
AddressSegmentSeriesgetSection in interface AddressSegmentSeriesgetSection in interface IPAddressSegmentSeriespublic IPv4AddressSection getSection(int index)
AddressSegmentSeriesgetSection in interface AddressSegmentSeriesgetSection in interface IPAddressSegmentSeriesgetSection in class IPAddressSectionpublic IPv4AddressSection getSection(int index, int endIndex)
AddressSegmentSeriesgetSection in interface AddressSegmentSeriesgetSection in interface IPAddressSegmentSeriesgetSection in class IPAddressSectionpublic IPv4AddressSection getLowerNonZeroHost()
IPAddressSegmentSeriesIPAddressSegmentSeries.getLower(), but will not return a series that has a prefix length and whose host value is zero.
If this series has no prefix length, returns the same series as IPAddressSegmentSeries.getLower().getLowerNonZeroHost in interface IPAddressSegmentSeriesgetLowerNonZeroHost in class IPAddressSectionpublic IPv4AddressSection getLower()
AddressSegmentSeriesgetLower in interface AddressComponentgetLower in interface AddressSectiongetLower in interface AddressSegmentSeriesgetLower in interface IPAddressSegmentSeriesgetLower in class IPAddressSectionpublic IPv4AddressSection getUpper()
AddressSegmentSeriesgetUpper in interface AddressComponentgetUpper in interface AddressSectiongetUpper in interface AddressSegmentSeriesgetUpper in interface IPAddressSegmentSeriesgetUpper in class IPAddressSectionpublic int intValue()
public int upperIntValue()
public long longValue()
public long upperLongValue()
public IPv4AddressSection reverseBits(boolean perByte)
IPAddressSegmentSeriesIf this has an associated prefix length, then the prefix length is dropped in the reversed series.
If this represents a range of values that cannot be reversed,
because reversing the range results in a set of addresses that cannot be described by a range, then this throws IncompatibleAddressException.
In such cases you can call IPAddressSegmentSeries.iterator(), IPAddressSegmentSeries.getLower(), IPAddressSegmentSeries.getUpper() or some other method to transform the address
into an address representing a single value before reversing.
reverseBits in interface AddressComponentreverseBits in interface AddressSectionreverseBits in interface AddressSegmentSeriesreverseBits in interface IPAddressSegmentSeriesreverseBits in class IPAddressSectionperByte - if true, only the bits in each byte are reversed, if false, then all bits in the address are reversedpublic IPv4AddressSection reverseBytes()
AddressSegmentSeriesreverseBytes in interface AddressComponentreverseBytes in interface AddressSectionreverseBytes in interface AddressSegmentSeriesreverseBytes in interface IPAddressSegmentSeriesreverseBytes in class IPAddressSectionpublic IPv4AddressSection reverseBytesPerSegment()
AddressSegmentSeriesreverseBytesPerSegment in interface AddressSectionreverseBytesPerSegment in interface AddressSegmentSeriesreverseBytesPerSegment in interface IPAddressSegmentSeriesreverseBytesPerSegment in class IPAddressSectionpublic IPv4AddressSection reverseSegments()
AddressSegmentSeriesIncompatibleAddressException since all address series can reverse their segments.reverseSegments in interface AddressSectionreverseSegments in interface AddressSegmentSeriesreverseSegments in interface IPAddressSegmentSeriesreverseSegments in class IPAddressSectionpublic java.lang.Iterable<IPv4AddressSection> getIterable()
AddressComponentAddressComponent.iterator() directly.getIterable in interface AddressComponentgetIterable in interface AddressSectiongetIterable in interface AddressSegmentSeriesgetIterable in interface IPAddressSegmentSeriesgetIterable in class IPAddressSectionpublic java.util.Iterator<IPv4AddressSection> nonZeroHostIterator()
nonZeroHostIterator in interface IPAddressSegmentSeriesnonZeroHostIterator in class IPAddressSectionpublic java.util.Iterator<IPv4AddressSection> iterator()
AddressSegmentSeriesiterator in interface AddressComponentiterator in interface AddressSectioniterator in interface AddressSegmentSeriesiterator in interface IPAddressSegmentSeriesiterator in interface java.lang.Iterable<IPv4AddressSection>iterator in class IPAddressSectionpublic java.util.Iterator<IPv4AddressSection> prefixBlockIterator()
AddressSegmentSeriesAddressSegmentSeries.iterator()prefixBlockIterator in interface AddressSectionprefixBlockIterator in interface AddressSegmentSeriesprefixBlockIterator in interface IPAddressSegmentSeriesprefixBlockIterator in class IPAddressSectionpublic java.util.Iterator<IPv4AddressSegment[]> segmentsNonZeroHostIterator()
segmentsNonZeroHostIterator in interface IPAddressSegmentSeriespublic java.util.Iterator<IPv4AddressSegment[]> segmentsIterator()
AddressSegmentSeriessegmentsIterator in interface AddressSegmentSeriessegmentsIterator in interface IPAddressSegmentSeriespublic IPv4AddressSection increment(long increment)
AddressSegmentSeriesIf the subnet has multiple values and the increment exceeds the subnet size, then the amount by which is exceeds the size is added to the upper series of the range (the final iterator value) or is subtracted from the lower series of the range (the first iterator value) if negative.
If the subnet is just a single address values, the series is simply incremented by the given value, positive or negative.
If a subnet has multiple values, a positive increment value is equivalent to the same number of values from the iterator. For instance, a increment of 1 is value 1 from the iterator, an increment of 2 is the second value from the iterator, and so on. A negative increment is equivalent to the same number of values preceding the upper bound of the iterator. For instance, an increment of -1 is the last value from the iterator, and increment of -2 is the second last value, and so on.
Therefore, to get the series just above the highest series of the subnet, use an increment of size:count > 1 ? count + 1 : 1 where count is the subnet size.
To get the series just below the lowest series of the subnet, use an increment of size:-(count > 1 ? count + 1 : 1) where count is the subnet size.
increment in interface AddressSectionincrement in interface AddressSegmentSeriesincrement in interface IPAddressSegmentSeriesincrement in class IPAddressSectionpublic long getIPv4Count(boolean excludeZeroHosts)
public long getIPv4PrefixCount()
public java.math.BigInteger getPrefixCount()
AddressDivisionSeries
If this has no prefix length, returns the same value as AddressItem.getCount()
getPrefixCount in interface AddressDivisionSeriesgetPrefixCount in class AddressDivisionGroupingpublic IPv4AddressSegment getDivision(int index)
getDivision in interface AddressDivisionSeriesgetDivision in interface AddressStringDivisionSeriesgetDivision in interface IPAddressStringDivisionSeriesgetDivision in class IPAddressSectionpublic IPv4AddressSegment getSegment(int index)
AddressSegmentSeriesgetSegment in interface AddressSegmentSeriesgetSegment in interface IPAddressSegmentSeriesgetSegment in class IPAddressSectionpublic void getSegments(java.util.Collection<? super IPv4AddressSegment> segs)
public void getSegments(int start,
int end,
java.util.Collection<? super IPv4AddressSegment> segs)
public int getBitsPerSegment()
AddressSegmentSeriesgetBitsPerSegment in interface AddressSegmentSeriespublic int getBytesPerSegment()
AddressSegmentSeriesgetBytesPerSegment in interface AddressSegmentSeriespublic int getBitCount()
getBitCount in interface AddressItemgetBitCount in class IPAddressSectionpublic int getByteCount()
AddressComponentgetByteCount in interface AddressComponentgetByteCount in class IPAddressSectionpublic boolean isIPv4()
isIPv4 in class IPAddressSectionpublic IPAddress.IPVersion getIPVersion()
IPAddressSegmentSeriesgetIPVersion in interface IPAddressSegmentSeriespublic boolean matchesWithMask(IPAddressSection other, IPAddressSection mask)
IPAddressSectionmatchesWithMask in class IPAddressSectionpublic boolean equals(java.lang.Object o)
equals in class IPAddressDivisionGroupingpublic IPv4AddressSection append(IPv4AddressSection other)
public IPv4AddressSection insert(int index, IPv4AddressSection other)
public IPv4AddressSection replace(int index, IPv4AddressSection other)
index - other - public IPv4AddressSection appendToNetwork(IPv4AddressSection other)
public IPv4AddressSection replace(int startIndex, int endIndex, IPv4AddressSection replacement, int replacementStartIndex, int replacementEndIndex)
startIndex - endIndex - replacement - replacementStartIndex - replacementEndIndex - java.lang.IndexOutOfBoundsExceptionIncompatibleAddressException - if the resulting section would exceed the maximum segment count for this address type and versionpublic IPv4AddressSection intersect(IPv4AddressSection other) throws SizeMismatchException
This is also known as the conjunction of the two sets of address sections.
other - SizeMismatchExceptionpublic IPv4AddressSection[] subtract(IPv4AddressSection other) throws SizeMismatchException
Computes the subnet difference, the set of addresses in this address section but not in the provided section. This is also known as the relative complement of the given argument in this subnet.
Keep in mind this is set subtraction, not subtraction of segment values. We have a subnet of addresses and we are removing some of those addresses.
other - SizeMismatchException - if the two sections are different sizespublic boolean contains(AddressSection other)
AddressSectioncontains in interface AddressSectioncontains in class IPAddressSectionpublic IPv4AddressNetwork getNetwork()
AddressSegmentSeriesgetNetwork in interface AddressSegmentSeriesgetNetwork in interface IPAddressStringDivisionSeriesgetNetwork in interface IPAddressSegmentSeriesgetNetwork in class IPAddressDivisionGroupingpublic IPv4AddressSection adjustPrefixBySegment(boolean nextSegment)
AddressSegmentSeries
Follows the same rules as AddressSegmentSeries.adjustPrefixLength(int):
When prefix length is increased, the bits moved within the prefix become zero.
When a prefix length is decreased, the bits moved outside the prefix become zero.
adjustPrefixBySegment in interface AddressSectionadjustPrefixBySegment in interface AddressSegmentSeriesadjustPrefixBySegment in interface IPAddressSegmentSeriesadjustPrefixBySegment in class IPAddressSectionnextSegment - whether to move prefix to previous or following segment coundarypublic IPv4AddressSection adjustPrefixBySegment(boolean nextSegment, boolean zeroed)
AddressSegmentSeriesadjustPrefixBySegment in interface AddressSectionadjustPrefixBySegment in interface AddressSegmentSeriesadjustPrefixBySegment in interface IPAddressSegmentSeriesadjustPrefixBySegment in class IPAddressSectionnextSegment - whether to move prefix to previous or following segment coundaryzeroed - whether the bits that move from one side of the prefix to the other become zero or retain their original valuespublic IPv4AddressSection adjustPrefixLength(int adjustment)
AddressSegmentSeriesWhen prefix length is increased, the bits moved within the prefix become zero. When the prefix is extended beyond the segment series boundary, it is removed. When a prefix length is decreased, the bits moved outside the prefix become zero.
adjustPrefixLength in interface AddressSectionadjustPrefixLength in interface AddressSegmentSeriesadjustPrefixLength in interface IPAddressSegmentSeriesadjustPrefixLength in class IPAddressSectionpublic IPv4AddressSection adjustPrefixLength(int adjustment, boolean zeroed)
AddressSegmentSeriesadjustPrefixLength in interface AddressSectionadjustPrefixLength in interface AddressSegmentSeriesadjustPrefixLength in interface IPAddressSegmentSeriesadjustPrefixLength in class IPAddressSectionadjustment - the incrementzeroed - whether the bits that move from one side of the prefix to the other become zero or retain their original valuespublic IPv4AddressSection applyPrefixLength(int networkPrefixLength)
AddressSegmentSeries
Similar to AddressSegmentSeries.setPrefixLength(int) except that prefix lengths are never increased.
When this series already has a prefix length that is less than or equal to the requested prefix length, this series is returned.
Otherwise the returned series has the given prefix length.
The bits moved outside the prefix will become zero in the returned series.
applyPrefixLength in interface AddressSectionapplyPrefixLength in interface AddressSegmentSeriesapplyPrefixLength in interface IPAddressSegmentSeriesapplyPrefixLength in class IPAddressSectionAddressSegmentSeries.setPrefixLength(int)public IPv4AddressSection setPrefixLength(int networkPrefixLength)
AddressSegmentSeriesIf this series has a prefix length, and the prefix length is increased, the bits moved within the prefix become zero.
When the prefix is extended beyond the segment series boundary, it is removed.
The bits that move from one side of the prefix length to the other (ie bits moved into the prefix or outside the prefix) are zeroed.
setPrefixLength in interface AddressSectionsetPrefixLength in interface AddressSegmentSeriessetPrefixLength in interface IPAddressSegmentSeriessetPrefixLength in class IPAddressSectionAddressSegmentSeries.applyPrefixLength(int)public IPv4AddressSection setPrefixLength(int networkPrefixLength, boolean withZeros)
AddressSegmentSeriesWhen the prefix is extended beyond the segment series boundary, it is removed.
setPrefixLength in interface AddressSectionsetPrefixLength in interface AddressSegmentSeriessetPrefixLength in interface IPAddressSegmentSeriessetPrefixLength in class IPAddressSectionwithZeros - whether the bits that move from one side of the prefix length to the other (ie bits moved into the prefix or outside the prefix) are zeroed.public IPv4AddressSection removePrefixLength()
IPAddressSegmentSeriesremovePrefixLength in interface AddressSectionremovePrefixLength in interface AddressSegmentSeriesremovePrefixLength in interface IPAddressSegmentSeriesremovePrefixLength in class IPAddressSectionIPAddressSegmentSeries.removePrefixLength(boolean)public IPv4AddressSection removePrefixLength(boolean zeroed)
IPAddressSegmentSeriesIPAddressSegmentSeries.removePrefixLength()removePrefixLength in interface AddressSectionremovePrefixLength in interface AddressSegmentSeriesremovePrefixLength in interface IPAddressSegmentSeriesremovePrefixLength in class IPAddressSectionzeroed - whether the host bits become zero.public IPv4AddressSection toZeroHost() throws IncompatibleAddressException
IPAddressSegmentSeries
The resultant series will have the same prefix length if AddressNetwork.getPrefixConfiguration() is not AddressNetwork.PrefixConfiguration.ALL_PREFIXED_ADDRESSES_ARE_SUBNETS,
otherwise it will no longer have a prefix length.
For instance, you can get the network address for a subnet as follows:
String addrStr = "1.2.3.4/16";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress networkAddress = address.toZeroHost(); //1.2.0.0
toZeroHost in interface IPAddressSegmentSeriestoZeroHost in class IPAddressSectionIncompatibleAddressExceptionpublic IPv4AddressSection toZeroHost(int prefixLength)
IPAddressSegmentSeriesIf this series has the same prefix length, then the resulting series will too, otherwise the resulting series will have no prefix length.
This is nearly equivalent to doing the mask (bitwise conjunction) of this address series with the network mask for the given prefix length, but without the possibility of IncompatibleAddressException that can occur when applying a mask to a range of values. Instead, in this case, if the resulting series has a range of values, then the resulting series range boundaries will have host values of 0, but not necessarily the intervening values.
For instance, you can get the network address for a subnet of prefix length 16 as follows:
String addrStr = "1.2.3.4";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress networkAddress = address.toZeroHost(16); //1.2.0.0
toZeroHost in interface IPAddressSegmentSeriestoZeroHost in class IPAddressSectionpublic IPv4AddressSection toMaxHost() throws IncompatibleAddressException
IPAddressSegmentSeries
The resultant series will have the same prefix length if AddressNetwork.getPrefixConfiguration() is not AddressNetwork.PrefixConfiguration.ALL_PREFIXED_ADDRESSES_ARE_SUBNETS,
otherwise it will no longer have a prefix length.
For instance, you can get the broadcast address for a subnet as follows:
String addrStr = "1.2.3.4/16";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress broadcastAddress = address.toMaxHost(); //1.2.255.255
toMaxHost in interface IPAddressSegmentSeriestoMaxHost in class IPAddressSectionIncompatibleAddressExceptionpublic IPv4AddressSection createMaxHost()
public IPv4AddressSection toMaxHost(int prefixLength)
IPAddressSegmentSeriesIf this series has the same prefix length, then the resulting series will too, otherwise the resulting series will have no prefix length.
This is nearly equivalent to doing the bitwise or (bitwise disjunction) of this address series with the network mask for the given prefix length, but without the possibility of IncompatibleAddressException that can occur when applying a mask to a range of values. Instead, in this case, if the resulting series has a range of values, then the resulting series range boundaries will have host values of all ones, but not necessarily the intervening values.
For instance, you can get the broadcast address for a subnet of prefix length 16 as follows:
String addrStr = "1.2.3.4";
IPAddress address = new IPAddressString(addrStr).getAddress();
IPAddress broadcastAddress = address.toMaxHost(16); //1.2.255.255
toMaxHost in interface IPAddressSegmentSeriestoMaxHost in class IPAddressSectionpublic IPv4AddressSection mask(IPv4AddressSection mask, boolean retainPrefix) throws IncompatibleAddressException, PrefixLenException, SizeMismatchException
mask - retainPrefix - whether to drop the prefixIncompatibleAddressExceptionPrefixLenExceptionSizeMismatchExceptionpublic IPv4AddressSection mask(IPv4AddressSection mask) throws IncompatibleAddressException
mask(IPv4AddressSection, boolean) with the second argument as false.IncompatibleAddressExceptionpublic IPv4AddressSection maskNetwork(IPv4AddressSection mask, int networkPrefixLength) throws IncompatibleAddressException, PrefixLenException, SizeMismatchException
bitwiseOr(IPv4AddressSection) or replace(int, IPv4AddressSection)mask - networkPrefixLength - IncompatibleAddressExceptionPrefixLenExceptionSizeMismatchExceptionpublic IPv4AddressSection bitwiseOr(IPv4AddressSection mask) throws IncompatibleAddressException
bitwiseOr(IPv4AddressSection, boolean) with the second argument as false.IncompatibleAddressExceptionpublic IPv4AddressSection bitwiseOr(IPv4AddressSection mask, boolean retainPrefix) throws IncompatibleAddressException, SizeMismatchException
mask(IPv4AddressSection) which does the bitwise conjunction.retainPrefix - whether the result will retain the same prefix length as this.IncompatibleAddressExceptionSizeMismatchExceptionpublic IPv4AddressSection bitwiseOrNetwork(IPv4AddressSection mask, int networkPrefixLength) throws IncompatibleAddressException, SizeMismatchException
maskNetwork(IPv4AddressSection, int) which does the bitwise conjunction.
Any existing prefix length is dropped for the new prefix length and the disjunction is applied up to the end the new prefix length.
mask - IncompatibleAddressExceptionSizeMismatchExceptionpublic IPv4AddressSection getNetworkSection()
IPAddressSegmentSeriesgetNetworkSection in interface IPAddressSegmentSeriespublic IPv4AddressSection getNetworkSection(int networkPrefixLength) throws PrefixLenException
IPAddressSegmentSeriesgetNetworkSection in interface IPAddressSegmentSeriesPrefixLenExceptionpublic IPv4AddressSection getNetworkSection(int networkPrefixLength, boolean withPrefixLength) throws PrefixLenException
IPAddressSegmentSeriesgetNetworkSection in interface IPAddressSegmentSerieswithPrefixLength - whether the resulting section will have networkPrefixLength as the associated prefix length or notPrefixLenExceptionpublic IPv4AddressSection getHostSection()
IPAddressSegmentSeriesgetHostSection in interface IPAddressSegmentSeriespublic IPv4AddressSection getHostSection(int networkPrefixLength) throws PrefixLenException
IPAddressSegmentSeriesgetHostSection in interface IPAddressSegmentSeriesPrefixLenExceptionpublic IPv4AddressSection toPrefixBlock()
IPAddressSegmentSeriestoPrefixBlock in interface AddressSectiontoPrefixBlock in interface AddressSegmentSeriestoPrefixBlock in interface IPAddressSegmentSeriestoPrefixBlock in class IPAddressSectionpublic IPv4AddressSection toPrefixBlock(int networkPrefixLength) throws PrefixLenException
IPAddressSegmentSeriestoPrefixBlock in interface IPAddressSegmentSeriestoPrefixBlock in class IPAddressSectionPrefixLenExceptionpublic IPv4AddressSection assignPrefixForSingleBlock()
IPAddressSectionIf no such prefix length exists, returns null.
If this address represents just a single address, "this" is returned.
assignPrefixForSingleBlock in interface IPAddressSegmentSeriesassignPrefixForSingleBlock in class IPAddressSectionIPAddressSegmentSeries.toPrefixBlock(),
IPAddressSegmentSeries.assignMinPrefixForBlock()public IPv4AddressSection assignMinPrefixForBlock()
IPAddressSectionassignMinPrefixForBlock in interface IPAddressSegmentSeriesassignMinPrefixForBlock in class IPAddressSectionIPAddressSegmentSeries.toPrefixBlock(),
IPAddressSegmentSeries.assignPrefixForSingleBlock()public IPv4AddressSection[] getSpanningPrefixBlocks(IPv4AddressSection other)
other - public IPv4AddressSection[] mergeBlocks(IPv6AddressSection... sections) throws SizeMismatchException
sections - the sections to merge with thisSizeMismatchExceptionpublic java.lang.String toCanonicalString()
toCanonicalString in interface AddressSegmentSeriespublic java.lang.String toFullString()
toFullString in interface IPAddressSegmentSeriespublic java.lang.String toCompressedString()
toCompressedString in interface AddressSegmentSeriespublic java.lang.String toNormalizedString()
toCanonicalString().toNormalizedString in interface AddressComponentpublic java.lang.String toCompressedWildcardString()
IPAddressSegmentSeriestoCompressedWildcardString in interface IPAddressSegmentSeriespublic java.lang.String toSubnetString()
IPAddressSegmentSeriestoSubnetString in interface IPAddressSegmentSeriespublic java.lang.String toPrefixLengthString()
IPAddressSegmentSeriestoPrefixLengthString in interface IPAddressSegmentSeriespublic 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()
IPAddressSegmentSeriestoNormalizedWildcardString in interface IPAddressSegmentSeriespublic java.lang.String toCanonicalWildcardString()
IPAddressSegmentSeriestoCanonicalWildcardString in interface IPAddressSegmentSeriespublic java.lang.String toSQLWildcardString()
IPAddressSegmentSeriesAddress.SEGMENT_SQL_WILDCARD instead of Address.SEGMENT_WILDCARD and also uses Address.SEGMENT_SQL_SINGLE_WILDCARDtoSQLWildcardString in interface IPAddressSegmentSeriespublic java.lang.String toReverseDNSLookupString()
IPAddressSegmentSeriestoReverseDNSLookupString in interface IPAddressSegmentSeriespublic java.lang.String toNormalizedString(IPAddressSection.IPStringOptions stringParams, int joinCount)
public IPAddressDivisionGrouping toJoinedSegments(int joinCount)
public IPAddressPartStringCollection toAllStringCollection()
IPAddressSectiontoAllStringCollection in class IPAddressSectionpublic IPAddressPartStringCollection toStandardStringCollection()
IPAddressSectiontoStandardStringCollection in class IPAddressSectionpublic IPAddressPartStringCollection toDatabaseSearchStringCollection()
IPAddressSectiontoDatabaseSearchStringCollection in class IPAddressSectionpublic IPAddressPartStringCollection toStringCollection(IPAddressSection.IPStringBuilderOptions opts)
toStringCollection in interface IPAddressSegmentSeriespublic IPAddressPartStringCollection toStringCollection(IPv4AddressSection.IPv4StringBuilderOptions opts)
public IPAddressStringDivisionSeries[] getParts(IPAddressSection.IPStringBuilderOptions options)
IPAddressSectionIPAddressDivisionGroupinggetParts in class IPAddressSectionpublic IPAddressStringDivisionSeries[] getParts(IPv4AddressSection.IPv4StringBuilderOptions options)