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.WildcardOptions
IPAddressDivisionGrouping.Range, IPAddressDivisionGrouping.RangeList
AddressDivisionGrouping.StringOptions
Constructor and Description |
---|
IPv4AddressSection(Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider) |
IPv4AddressSection(Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider,
java.lang.Integer prefix) |
IPv4AddressSection(byte[] bytes) |
IPv4AddressSection(byte[] bytes,
java.lang.Integer prefix) |
IPv4AddressSection(int value) |
IPv4AddressSection(int value,
java.lang.Integer prefix) |
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 |
adjustPrefixLength(int adjustment)
Increases or decreases prefix length by the given increment.
|
IPv4AddressSection |
append(IPv4AddressSection other) |
IPv4AddressSection |
applyPrefixLength(int networkPrefixLength)
Applies the given network prefix bit length.
|
IPv4AddressSection |
bitwiseOr(IPv4AddressSection mask)
Does the bitwise disjunction with this address.
|
IPv4AddressSection |
bitwiseOrNetwork(IPv4AddressSection mask,
int networkPrefixLength)
Does the bitwise disjunction with this address.
|
boolean |
contains(AddressSection other)
Determines if one section contains another.
|
boolean |
equals(java.lang.Object o) |
int |
getBitsPerSegment() |
int |
getByteIndex(int networkPrefixLength) |
int |
getBytesPerSegment() |
IPv4AddressSection |
getHostSection(int networkPrefixLength) |
IPAddress.IPVersion |
getIPVersion() |
java.lang.Iterable<IPv4AddressSection> |
getIterable()
Useful for using an instance in a "for-each loop".
|
IPv4AddressSection |
getLower()
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.
|
IPv4AddressNetwork |
getNetwork() |
IPv4AddressSection |
getNetworkSection(int networkPrefixLength) |
IPv4AddressSection |
getNetworkSection(int networkPrefixLength,
boolean withPrefixLength) |
IPAddressStringDivisionSeries[] |
getParts(IPAddressSection.IPStringBuilderOptions options)
Get all representations of this address including this IPAddressSection.
|
IPAddressStringDivisionSeries[] |
getParts(IPv4AddressSection.IPv4StringBuilderOptions options) |
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) |
int |
getSegmentIndex(int networkPrefixLength) |
IPv4AddressSegment[] |
getSegments() |
void |
getSegments(java.util.Collection<? super IPv4AddressSegment> segs) |
void |
getSegments(int start,
int end,
java.util.Collection<? super IPv4AddressSegment> segs) |
IPv4AddressSection |
getUpper()
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.
|
boolean |
isIPv4() |
java.util.Iterator<IPv4AddressSection> |
iterator()
An address component can represent a single segment, address, or section, or it can represent multiple,
typically a subnet or range of segment, address, or section values.
|
IPv4AddressSection |
mask(IPv4AddressSection mask) |
IPv4AddressSection |
maskNetwork(IPv4AddressSection mask,
int networkPrefixLength)
Applies the given mask to the network section of the address as indicated by the given prefix length.
|
IPv4AddressSection |
prepend(IPv4AddressSection other) |
IPv4AddressSection |
removePrefixLength()
Removes the prefix.
|
IPv4AddressSection |
removePrefixLength(boolean zeroed) |
IPv4AddressSection |
replace(IPv4AddressSection other,
int index) |
IPv4AddressSection |
reverseBits(boolean perByte)
Returns a new segment series with 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() |
IPv4AddressSection |
setPrefixLength(int networkPrefixLength)
Sets the prefix length.
|
IPv4AddressSection |
setPrefixLength(int networkPrefixLength,
boolean withZeros) |
IPv4AddressSection[] |
subtract(IPv4AddressSection 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) |
IPAddressDivisionGrouping |
toJoinedSegments(int joinCount) |
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.IPStringOptions stringParams,
int joinCount) |
java.lang.String |
toNormalizedWildcardString()
This produces a string similar to the normalized string and avoids the CIDR prefix.
|
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 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) |
java.lang.String |
toSubnetString()
Produces a consistent subnet string.
|
bitsPerSegment, bytesPerSegment, contains, getBitCount, getByteCount, getEquivalentPrefix, getHostBits, getMaskPrefixLength, getMinPrefix, getSegmentCount, getSegmentPrefixLength, getSegmentPrefixLength, getSegments, getSegments, getSegmentStrings, getStartsWithSQLClause, getStartsWithSQLClause, isEntireAddress, isFullRange, isIPv6, isMaskCompatibleWithRange, toBinaryString, toHexString, toMinPrefixedEquivalent, toNormalizedString, toNormalizedString, toOctalString, toPrefixedEquivalent, toString
getDivision, getNetworkPrefixLength, getPrefixLength, getZeroRangeSegments, getZeroSegments, isMore, isMultipleByNetworkPrefix, isMultipleByPrefix, isPrefixed, isRangeEquivalentToPrefix
compareTo, getBytes, getBytes, getCount, getDivisionCount, getUpperBytes, getUpperBytes, hashCode, isMultiple, isRangeEquivalent, isZero
getDivision, getPrefixLength, isMore, isMultipleByPrefix, isPrefixed, isRangeEquivalentToPrefix
getDivisionCount
getBytes, getBytes, getCount, getUpperBytes, getUpperBytes, isMultiple, isZero
public IPv4AddressSection(IPv4AddressSegment[] segments, java.lang.Integer networkPrefixLength)
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
- public IPv4AddressSection(IPv4AddressSegment[] segments)
public IPv4AddressSection(IPv4AddressSegment segment)
segment
- public IPv4AddressSection(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, java.lang.Integer prefix)
public IPv4AddressSection(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider)
public IPv4AddressSection(int value, java.lang.Integer prefix)
public IPv4AddressSection(int value)
public IPv4AddressSection(byte[] bytes, java.lang.Integer prefix)
public IPv4AddressSection(byte[] bytes)
public IPv4AddressSegment[] getSegments()
getSegments
in interface AddressSegmentSeries
getSegments
in class IPAddressSection
public IPv4AddressSection getSection(int index)
AddressSegmentSeries
getSection
in interface AddressSection
getSection
in interface AddressSegmentSeries
getSection
in class IPAddressSection
public IPv4AddressSection getSection(int index, int endIndex)
AddressSegmentSeries
getSection
in interface AddressSection
getSection
in interface AddressSegmentSeries
getSection
in class IPAddressSection
public IPv4AddressSection getLower()
IPAddressSection
getLower
in interface AddressComponent
getLower
in interface AddressSection
getLower
in interface AddressSegmentSeries
getLower
in class IPAddressSection
public IPv4AddressSection getUpper()
IPAddressSection
getUpper
in interface AddressComponent
getUpper
in interface AddressSection
getUpper
in interface AddressSegmentSeries
getUpper
in class IPAddressSection
public IPv4AddressSection reverseBits(boolean perByte)
AddressSegmentSeries
reverseBits
in interface AddressComponent
reverseBits
in interface AddressSection
reverseBits
in interface AddressSegmentSeries
reverseBits
in class IPAddressSection
perByte
- if true, only the bits in each byte are reversed, if false, then all bits in the component are reversedpublic IPv4AddressSection reverseBytes()
AddressSegmentSeries
reverseBytes
in interface AddressComponent
reverseBytes
in interface AddressSection
reverseBytes
in interface AddressSegmentSeries
reverseBytes
in class IPAddressSection
public IPv4AddressSection reverseBytesPerSegment()
AddressSegmentSeries
reverseBytesPerSegment
in interface AddressSection
reverseBytesPerSegment
in interface AddressSegmentSeries
reverseBytesPerSegment
in class IPAddressSection
public IPv4AddressSection reverseSegments()
AddressSegmentSeries
reverseSegments
in interface AddressSection
reverseSegments
in interface AddressSegmentSeries
reverseSegments
in class IPAddressSection
public java.lang.Iterable<IPv4AddressSection> getIterable()
AddressComponent
AddressComponent.iterator()
directly.getIterable
in interface AddressComponent
getIterable
in interface AddressSection
getIterable
in interface AddressSegmentSeries
getIterable
in class IPAddressSection
public java.util.Iterator<IPv4AddressSection> iterator()
AddressComponent
AddressItem.isMultiple()
to determine if this instance represents multiple.
This method iterates through the individual elements.iterator
in interface AddressComponent
iterator
in interface AddressSection
iterator
in interface AddressSegmentSeries
iterator
in interface java.lang.Iterable<IPv4AddressSection>
iterator
in class IPAddressSection
public java.util.Iterator<IPv4AddressSegment[]> segmentsIterator()
segmentsIterator
in interface AddressSegmentSeries
segmentsIterator
in class IPAddressSection
public IPv4AddressSegment getSegment(int index)
getSegment
in interface AddressSegmentSeries
getSegment
in class IPAddressSection
public void getSegments(java.util.Collection<? super IPv4AddressSegment> segs)
public void getSegments(int start, int end, java.util.Collection<? super IPv4AddressSegment> segs)
public int getBitsPerSegment()
getBitsPerSegment
in interface AddressSegmentSeries
public int getBytesPerSegment()
getBytesPerSegment
in interface AddressSegmentSeries
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 IPAddressDivisionGrouping
public IPv4AddressSection replace(IPv4AddressSection other, int index)
public IPv4AddressSection prepend(IPv4AddressSection other)
public IPv4AddressSection append(IPv4AddressSection other)
public boolean contains(AddressSection other)
AddressSection
contains
in interface AddressSection
public IPv4AddressSection[] subtract(IPv4AddressSection other)
other
- AddressTypeException
- if the two sections are not comparablepublic int getByteIndex(int networkPrefixLength)
getByteIndex
in class IPAddressSection
public int getSegmentIndex(int networkPrefixLength)
getSegmentIndex
in class IPAddressSection
public IPv4AddressNetwork getNetwork()
getNetwork
in class IPAddressSection
public IPv4AddressSection adjustPrefixBySegment(boolean nextSegment)
AddressSegmentSeries
adjustPrefixBySegment
in interface AddressSection
adjustPrefixBySegment
in interface AddressSegmentSeries
adjustPrefixBySegment
in class IPAddressSection
public IPv4AddressSection adjustPrefixLength(int adjustment)
AddressSegmentSeries
adjustPrefixLength
in interface AddressSection
adjustPrefixLength
in interface AddressSegmentSeries
adjustPrefixLength
in class IPAddressSection
public IPv4AddressSection applyPrefixLength(int networkPrefixLength)
IPAddressSection
applyPrefixLength
in interface AddressSection
applyPrefixLength
in interface AddressSegmentSeries
applyPrefixLength
in class IPAddressSection
public IPv4AddressSection setPrefixLength(int networkPrefixLength)
AddressSegmentSeries
setPrefixLength
in interface AddressSection
setPrefixLength
in interface AddressSegmentSeries
setPrefixLength
in class IPAddressSection
public IPv4AddressSection setPrefixLength(int networkPrefixLength, boolean withZeros)
setPrefixLength
in class IPAddressSection
public IPv4AddressSection bitwiseOrNetwork(IPv4AddressSection mask, int networkPrefixLength) throws AddressTypeException
mask
- AddressTypeException
public IPv4AddressSection bitwiseOr(IPv4AddressSection mask) throws AddressTypeException
mask
- AddressTypeException
public IPv4AddressSection removePrefixLength()
AddressSegmentSeries
removePrefixLength
in interface AddressSection
removePrefixLength
in interface AddressSegmentSeries
removePrefixLength
in class IPAddressSection
public IPv4AddressSection removePrefixLength(boolean zeroed)
removePrefixLength
in class IPAddressSection
public IPv4AddressSection mask(IPv4AddressSection mask) throws AddressTypeException
AddressTypeException
public IPv4AddressSection maskNetwork(IPv4AddressSection mask, int networkPrefixLength) throws AddressTypeException
bitwiseOr(IPv4AddressSection)
or replace(IPv4AddressSection, int)
mask
- networkPrefixLength
- AddressTypeException
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 interface AddressSegmentSeries
public java.lang.String toFullString()
toFullString
in class IPAddressSection
public java.lang.String toCompressedString()
toCompressedString
in interface AddressSegmentSeries
toCompressedString
in class IPAddressSection
public java.lang.String toNormalizedString()
toNormalizedString
in interface AddressComponent
public java.lang.String toCompressedWildcardString()
IPAddressSection
toCompressedWildcardString
in class IPAddressSection
public java.lang.String toSubnetString()
IPAddressSection
toSubnetString
in class IPAddressSection
public java.lang.String toPrefixLengthString()
IPAddressSection
toPrefixLengthString
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 toReverseDNSLookupString()
IPAddressSection
toReverseDNSLookupString
in class IPAddressSection
public java.lang.String toNormalizedString(IPAddressSection.IPStringOptions stringParams, int joinCount)
public IPAddressDivisionGrouping 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 IPAddressStringDivisionSeries[] getParts(IPAddressSection.IPStringBuilderOptions options)
IPAddressSection
IPAddressDivisionGrouping
getParts
in class IPAddressSection
public IPAddressStringDivisionSeries[] getParts(IPv4AddressSection.IPv4StringBuilderOptions options)