public class IPv4AddressSegment extends IPAddressSegment implements java.lang.Iterable<IPv4AddressSegment>
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_CHARS |
ADJUST_RANGES_BY_PREFIX| Constructor and Description |
|---|
IPv4AddressSegment(int value)
Constructs a segment of an IPv4 address with the given value.
|
IPv4AddressSegment(int value,
java.lang.Integer segmentPrefixLength)
Constructs a segment of an IPv4 address.
|
IPv4AddressSegment(int lower,
int upper,
java.lang.Integer segmentPrefixLength)
Constructs a segment of an IPv4 address that represents a range of values.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(AddressSegment other) |
boolean |
equals(java.lang.Object other) |
int |
getBitCount() |
int |
getByteCount()
returns the number of bytes in each of the address components represented by this instance
|
int |
getDefaultTextualRadix() |
IPAddress.IPVersion |
getIPVersion() |
java.lang.Iterable<IPv4AddressSegment> |
getIterable()
Useful for using an instance in a "for-each loop".
|
IPv4AddressSegment |
getLower()
If this segment represents a range of values, returns a segment representing just the lowest value in the range, otherwise returns this.
|
int |
getMaxDigitCount() |
int |
getMaxSegmentValue()
Gets the maximum possible value for this type of segment (for the highest range value of this particular segment, use
AddressSegment.getUpper() |
static IPv4AddressNetwork.IPv4AddressCreator |
getSegmentCreator() |
IPv4AddressSegment |
getUpper()
If this segment represents a range of values, returns a segment representing just the highest value in the range, otherwise returns this.
|
boolean |
isIPv4() |
java.util.Iterator<IPv4AddressSegment> |
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.
|
IPv4AddressSegment |
removePrefixLength() |
IPv4AddressSegment |
removePrefixLength(boolean zeroed) |
IPv4AddressSegment |
reverseBits() |
IPv4AddressSegment |
reverseBits(boolean perByte)
Returns a new AddressComponent with the bits reversed.
|
IPv4AddressSegment |
reverseBytes()
Returns an AddressComponent with the bytes reversed.
|
IPv4AddressSegment |
toHostSegment(java.lang.Integer bits)
used by getHostSection, see
IPAddress.getHostSection(int) |
IPv4AddressSegment |
toMaskedSegment(IPAddressSegment maskSegment,
java.lang.Integer segmentPrefixLength)
returns a new segment masked by the given mask
This method applies the mask first to every address in the range, and it does not preserve any existing prefix.
|
IPv4AddressSegment |
toNetworkSegment(java.lang.Integer segmentPrefixLength)
used by constructors of IPAddressSection, see
IPAddress.getNetworkSection(int, boolean) |
IPv4AddressSegment |
toNetworkSegment(java.lang.Integer segmentPrefixLength,
boolean withPrefixLength)
used by getNetworkSection and by constructors of IPAddressSection, see
IPAddress.getNetworkSection(int, boolean) |
getBitCount, getByteCount, getDefaultTextualRadix, getDivisionValueCount, getLowerSegmentValue, getLowerValue, getMaxSegmentValue, getMaxValue, getMinPrefix, getSegmentPrefixLength, getUpperSegmentValue, getUpperValue, getValueCount, hashCode, isBoundedBy, isFullRange, isFullRange, isFullRange, isIPv6, isMaskCompatibleWithRange, isMaskCompatibleWithRange, isMultiple, matches, matchesWithMask, matchesWithPrefix, toHexString, toNormalizedString, toNormalizedStringgetConfiguredString, getDivisionPrefixLength, getMaskPrefixLength, getString, getWildcardString, isBitwiseOrCompatibleWithRange, isMaskCompatibleWithRange, isPrefixed, isRangeEquivalent, isRangeEquivalentToPrefix, isRangeUnchanged, isSamePrefixedRange, matchesWithPrefixcompareTo, getCount, getDigitCount, getMaxDigitCount, hasUppercaseVariations, isZero, matches, matchesWithMaskgetBytes, getBytes, getDigitCount, getPrefixAdjustedString, getStandardString, getUpperBytes, getUpperBytes, toStringgetBytes, getBytes, getCount, getUpperBytes, getUpperBytes, isZeropublic static final int MAX_CHARS
public IPv4AddressSegment(int value)
value - the value of the segmentpublic IPv4AddressSegment(int value,
java.lang.Integer segmentPrefixLength)
value - the value of the segment. If the segmentPrefixLength is non-null, the network prefix of the value is used, and the segment represents all segment values with the same network prefix.segmentPrefixLength - the segment prefix, which can be nullpublic IPv4AddressSegment(int lower,
int upper,
java.lang.Integer segmentPrefixLength)
segmentPrefixLength - the segment prefix length, which can be null. If segmentPrefixLength is non-null, this segment represents a range of segment values with the given network prefix length.lower - the lower value of the range of values represented by the segment. If segmentPrefixLength is non-null, the lower value becomes the smallest value with the same network prefix.upper - the upper value of the range of values represented by the segment. If segmentPrefixLength is non-null, the upper value becomes the largest value with the same network prefix.public boolean isIPv4()
isIPv4 in class IPAddressSegmentpublic IPAddress.IPVersion getIPVersion()
getIPVersion in class IPAddressSegmentpublic int getMaxSegmentValue()
AddressSegmentAddressSegment.getUpper()getMaxSegmentValue in interface AddressSegmentpublic IPv4AddressSegment toNetworkSegment(java.lang.Integer segmentPrefixLength)
IPAddressSegmentIPAddress.getNetworkSection(int, boolean)toNetworkSegment in class IPAddressSegmentpublic IPv4AddressSegment toNetworkSegment(java.lang.Integer segmentPrefixLength, boolean withPrefixLength)
IPAddressSegmentIPAddress.getNetworkSection(int, boolean)toNetworkSegment in class IPAddressSegmentpublic IPv4AddressSegment toHostSegment(java.lang.Integer bits)
IPAddressSegmentIPAddress.getHostSection(int)toHostSegment in class IPAddressSegmentpublic IPv4AddressSegment toMaskedSegment(IPAddressSegment maskSegment, java.lang.Integer segmentPrefixLength) throws AddressTypeException
IPAddressSegmentAddressTypeException is thrown.
See IPAddress.applyPrefixLength(int),
IPAddress#apply(IPAddress, Integer),
IPAddress#isMaskCompatibleWithRange(IPAddress, Integer)toMaskedSegment in class IPAddressSegmentAddressTypeExceptionpublic IPv4AddressSegment getLower()
IPAddressSegmentgetLower in interface AddressComponentgetLower in interface AddressSegmentgetLower in class IPAddressSegmentpublic IPv4AddressSegment getUpper()
IPAddressSegmentgetUpper in interface AddressComponentgetUpper in interface AddressSegmentgetUpper in class IPAddressSegmentpublic static IPv4AddressNetwork.IPv4AddressCreator getSegmentCreator()
public java.lang.Iterable<IPv4AddressSegment> getIterable()
AddressComponentAddressComponent.iterator() directly.getIterable in interface AddressComponentgetIterable in interface AddressSegmentgetIterable in class IPAddressSegmentpublic java.util.Iterator<IPv4AddressSegment> iterator()
AddressComponentAddressItem.isMultiple() to determine if this instance represents multiple.
This method iterates through the individual elements.iterator in interface AddressComponentiterator in interface AddressSegmentiterator in interface java.lang.Iterable<IPv4AddressSegment>iterator in class IPAddressSegmentpublic int getBitCount()
getBitCount in interface AddressItempublic int getByteCount()
AddressComponentgetByteCount in interface AddressComponentpublic int getDefaultTextualRadix()
getDefaultTextualRadix in class AddressDivisionBasepublic int getMaxDigitCount()
getMaxDigitCount in class AddressDivisionBasepublic IPv4AddressSegment reverseBits(boolean perByte)
AddressComponentreverseBits in interface AddressComponentreverseBits in interface AddressSegmentreverseBits in class IPAddressSegmentperByte - if true, only the bits in each byte are reversed, if false, then all bits in the component are reversedpublic IPv4AddressSegment reverseBits()
public IPv4AddressSegment reverseBytes()
AddressComponentreverseBytes in interface AddressComponentreverseBytes in interface AddressSegmentreverseBytes in class IPAddressSegmentpublic IPv4AddressSegment removePrefixLength(boolean zeroed)
removePrefixLength in class IPAddressSegmentpublic IPv4AddressSegment removePrefixLength()
removePrefixLength in class IPAddressSegmentpublic boolean contains(AddressSegment other)
contains in interface AddressSegmentcontains in class IPAddressSegmentpublic boolean equals(java.lang.Object other)
equals in interface AddressSegmentequals in class java.lang.Object