public class IPv4Address extends IPAddress implements java.lang.Iterable<IPv4Address>
| Modifier and Type | Class and Description | 
|---|---|
| static class  | IPv4Address.inet_aton_radix | 
| static interface  | IPv4Address.IPv4AddressConverter | 
IPAddress.IPVersion| Modifier and Type | Field and Description | 
|---|---|
| static int | BIT_COUNT | 
| static int | BITS_PER_SEGMENT | 
| static int | BYTE_COUNT | 
| static int | BYTES_PER_SEGMENT | 
| static int | DEFAULT_TEXTUAL_RADIX | 
| static int | MAX_STRING_LEN | 
| static int | MAX_VALUE_PER_SEGMENT | 
| static int | SEGMENT_COUNT | 
| static char | SEGMENT_SEPARATOR | 
addressComparator, addressConverter, PREFIX_LEN_SEPARATOR, RANGE_SEPARATOR, RANGE_SEPARATOR_STR, SEGMENT_SQL_SINGLE_WILDCARD, SEGMENT_SQL_SINGLE_WILDCARD_STR, SEGMENT_SQL_WILDCARD, SEGMENT_SQL_WILDCARD_STR, SEGMENT_WILDCARD, SEGMENT_WILDCARD_STR| Constructor and Description | 
|---|
| IPv4Address(byte[] bytes)Constructs an IPv4 address. | 
| IPv4Address(byte[] bytes,
           java.lang.Integer networkPrefixLength)Constructs an IPv4 address or subnet. | 
| IPv4Address(int address)Constructs an IPv4 address. | 
| IPv4Address(int address,
           java.lang.Integer networkPrefixLength)Constructs an IPv4 address or subnet. | 
| IPv4Address(IPv4AddressSection section)Constructs an IPv4 address or subnet. | 
| IPv4Address(IPv4AddressSegment[] segments)Constructs an IPv4 address or subnet. | 
| IPv4Address(IPv4AddressSegment[] segments,
           java.lang.Integer networkPrefixLength)Constructs an IPv4 address or subnet. | 
| Modifier and Type | Method and Description | 
|---|---|
| java.lang.Iterable<IPv4Address> | getAddresses() | 
| int | getBitCount() | 
| int | getByteCount() | 
| IPv4AddressSection | getHostSection()Generates the host section of the address. | 
| IPv4AddressSection | getHostSection(int networkPrefixLength)Generates the host section of the address. | 
| IPv6Address | getIPv4MappedAddress() | 
| static IPv4Address | getLoopback() | 
| IPv4Address | getLower()If this represents an address with ranging values, returns an address representing the lower values of the range. | 
| IPv4AddressNetwork | getNetwork() | 
| IPv4AddressSection | getNetworkSection()Generates the network section of the address if the address is a CIDR prefix, otherwise it generates the entire address as a prefixed address with prefix matching the address bit length. | 
| IPv4AddressSection | getNetworkSection(int networkPrefixLength,
                 boolean withPrefixLength)Generates the network section of the address. | 
| IPAddressPart[] | getParts(IPAddressSection.IPStringBuilderOptions options)Returns all the ways of breaking this address down into segments, as selected. | 
| IPAddressPart[] | getParts(IPv4AddressSection.IPv4StringBuilderOptions options) | 
| IPv4AddressSection | getSection()Returns the address as an address section comprising all segments in the address. | 
| IPv4AddressSegment | getSegment(int index) | 
| int | getSegmentCount() | 
| static java.lang.String[] | getStandardLoopbackStrings() | 
| IPv4Address | getUpper()If this represents an address with ranging values, returns an address representing the upper values of the range
 If this represents an address with a single value in each segment, returns this. | 
| boolean | isIPv4Convertible()Determines whether this address can be converted to IPv4, if not IPv4 already. | 
| boolean | isIPv6Convertible()Determines whether an address can be converted to IPv6, if not IPv6 already. | 
| boolean | isLinkLocal() | 
| boolean | isLoopback() | 
| boolean | isMulticast() | 
| boolean | isSiteLocal() | 
| java.util.Iterator<IPv4Address> | iterator() | 
| static IPv4AddressNetwork | network() | 
| IPv4Address[] | subtract(IPAddress 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() | 
| java.net.Inet4Address | toInetAddress() | 
| java.lang.String | toInetAtonString(IPv4Address.inet_aton_radix radix)Returns a string like the inet_aton style string | 
| java.lang.String | toInetAtonString(IPv4Address.inet_aton_radix radix,
                int joinedCount) | 
| IPv4Address | toIPv4()If this address is IPv4, or can be converted to IPv4, returns that  IPv4Address. | 
| IPv6Address | toIPv6()Returns this address converted to IPv6. | 
| 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 | 
| IPAddressPartStringCollection | toStandardStringCollection() | 
| IPAddressPartStringCollection | toStringCollection(IPAddressSection.IPStringBuilderOptions opts) | 
| IPAddressPartStringCollection | toStringCollection(IPv4AddressSection.IPv4StringBuilderOptions opts) | 
| IPv4Address | toSubnet(int networkPrefixLength)Creates a subnet address using the given CIDR prefix bits. | 
| IPv4Address | toSubnet(IPAddress mask)Creates a subnet address using the given mask. | 
| IPv4Address | toSubnet(IPAddress mask,
        java.lang.Integer networkPrefixLength)Creates a subnet address using the given mask. | 
| java.lang.String | toUNCHostName()Generates the Microsoft UNC path component for this address | 
bitCount, bitsPerSegment, byteCount, compareTo, contains, equals, from, from, from, from, getBitsPerSegment, getByteIndex, getBytes, getBytesPerSegment, getCount, getEquivalentPrefix, getIPVersion, getLocalHost, getLoopback, getLowestBytes, getMaskPrefixLength, getMatchesSQLClause, getMatchesSQLClause, getMaxSegmentValue, getMinPrefix, getNetworkPrefixLength, getNetworkSection, getSegmentIndex, getSegmentStrings, getStandardLoopbackStrings, hashCode, isAnyLocal, isIPv4, isIPv6, isMaskCompatibleWithRange, isMultiple, isMultipleByNetworkPrefix, isPrefixed, isRangeEquivalentToPrefix, isSameAddress, isZero, matches, maxSegmentValue, network, segmentCount, toAddressString, toAllStrings, toCanonicalHostName, toCanonicalString, toCanonicalWildcardString, toCompressedString, toCompressedWildcardString, toConvertedString, toDelimitedSQLStrs, toFullString, toHexString, toHostName, toNetworkPrefixLengthString, toNormalizedString, toNormalizedString, toNormalizedWildcardString, toPrefixedEquivalent, toPrefixedMin, toSQLWildcardString, toStandardStrings, toString, toStrings, toSubnetString, toSupernet, toSupernetpublic static final char SEGMENT_SEPARATOR
public static final int BITS_PER_SEGMENT
public static final int BYTES_PER_SEGMENT
public static final int SEGMENT_COUNT
public static final int BYTE_COUNT
public static final int BIT_COUNT
public static final int DEFAULT_TEXTUAL_RADIX
public static final int MAX_STRING_LEN
public static final int MAX_VALUE_PER_SEGMENT
public IPv4Address(IPv4AddressSegment[] segments, java.lang.Integer networkPrefixLength)
segments - the address segmentsnetworkPrefixLength - java.lang.IllegalArgumentException - if segments is not length 4public IPv4Address(IPv4AddressSegment[] segments)
segments - the address segmentsjava.lang.IllegalArgumentException - if segments is not length 4public IPv4Address(IPv4AddressSection section)
section - the address segmentsjava.lang.IllegalArgumentException - if section does not have 4 segmentspublic IPv4Address(int address)
address - the 4 byte IPv4 addresspublic IPv4Address(int address,
                   java.lang.Integer networkPrefixLength)
address - the 4 byte IPv4 addressnetworkPrefixLength - the CIDR network prefix length, which can be null for no prefixpublic IPv4Address(byte[] bytes)
bytes - must be a 4 byte IPv4 addressjava.lang.IllegalArgumentException - if bytes is not length 4public IPv4Address(byte[] bytes,
                   java.lang.Integer networkPrefixLength)
bytes - must be a 4 byte IPv4 addressnetworkPrefixLength - the CIDR network prefix length, which can be null for no prefixjava.lang.IllegalArgumentException - if bytes is not length 4public IPv4AddressSection getSection()
IPAddressgetSection in class IPAddresspublic IPv4AddressSegment getSegment(int index)
getSegment in class IPAddresspublic IPAddressPart[] getParts(IPAddressSection.IPStringBuilderOptions options)
IPAddresspublic IPAddressPart[] getParts(IPv4AddressSection.IPv4StringBuilderOptions options)
public int getSegmentCount()
getSegmentCount in class IPAddresspublic int getByteCount()
getByteCount in class IPAddresspublic int getBitCount()
getBitCount in class IPAddresspublic IPv4Address toIPv4()
IPAddressIPv4Address.  Otherwise, returns null.toIPv4 in class IPAddressIPAddress.isIPv4Convertible()public boolean isIPv4Convertible()
IPAddressIPAddress.toIPv4() to match the conversion.
 
 This method returns true for all IPv4 addresses.isIPv4Convertible in class IPAddresspublic IPv6Address getIPv4MappedAddress()
public boolean isIPv6Convertible()
IPAddressIPAddress.toIPv6() to match the conversion.
 
 This method returns true for all IPv6 addresses.isIPv6Convertible in class IPAddresstoIPv6()public IPv6Address toIPv6()
 This uses isIPv6Convertible() to determine convertibility, and that uses an instance of IPAddressConverter.DefaultAddressConverter which uses IPv4-mapped address mappings from rfc 4038.
 
 Override this method and IPv6Address.isIPv4Convertible() if you wish to map IPv4 to IPv6 according to the mappings defined by
 in IPv6Address.isIPv4Compatible(), IPv6Address.isIPv4Mapped(), IPv6Address.is6To4() or some other mapping.
 
 If you override this method, you should also override the isIPv6Convertible() method to match this behaviour, 
 and potentially also override the reverse conversion IPv6Address.toIPv4() in your IPv6Address subclass.
toIPv6 in class IPAddressIPv6Address.  Otherwise, returns null.public IPv4Address getLower()
IPAddresspublic IPv4Address getUpper()
IPAddresspublic java.util.Iterator<IPv4Address> iterator()
iterator in interface java.lang.Iterable<IPv4Address>iterator in class IPAddresspublic java.lang.Iterable<IPv4Address> getAddresses()
getAddresses in class IPAddresspublic static IPv4AddressNetwork network()
public IPv4AddressNetwork getNetwork()
getNetwork in class IPAddresspublic static IPv4Address getLoopback()
public static java.lang.String[] getStandardLoopbackStrings()
public IPv4Address[] subtract(IPAddress other)
IPAddresspublic IPv4Address toSubnet(int networkPrefixLength) throws IPAddressTypeException
IPAddresstoSubnet in class IPAddressIPAddressTypeExceptionpublic IPv4Address toSubnet(IPAddress mask) throws IPAddressTypeException
toSubnet in class IPAddressIPAddressTypeExceptionpublic IPv4Address toSubnet(IPAddress mask, java.lang.Integer networkPrefixLength) throws IPAddressTypeException
toSubnet in class IPAddressIPAddressTypeExceptionpublic IPv4AddressSection getNetworkSection(int networkPrefixLength, boolean withPrefixLength)
IPAddressgetNetworkSection in class IPAddresswithPrefixLength - whether the resulting section will have networkPrefixLength as the associated prefix length or notpublic IPv4AddressSection getNetworkSection()
IPAddressgetNetworkSection in class IPAddresspublic IPv4AddressSection getHostSection(int networkPrefixLength)
IPAddressgetHostSection in class IPAddresspublic IPv4AddressSection getHostSection()
IPAddressgetHostSection in class IPAddresspublic java.net.Inet4Address toInetAddress()
toInetAddress in class IPAddresspublic boolean isLinkLocal()
isLinkLocal in class IPAddressInetAddress.isLinkLocalAddress()public boolean isSiteLocal()
isSiteLocal in class IPAddressInetAddress.isSiteLocalAddress()public boolean isMulticast()
isMulticast in class IPAddressInetAddress.isMulticastAddress()public boolean isLoopback()
isLoopback in class IPAddressInetAddress.isLoopbackAddress()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 toUNCHostName()
IPAddresstoUNCHostName in class IPAddresspublic java.lang.String toReverseDNSLookupString()
IPAddresstoReverseDNSLookupString in class IPAddresspublic IPAddressPartStringCollection toStandardStringCollection()
toStandardStringCollection in class IPAddresspublic IPAddressPartStringCollection toAllStringCollection()
toAllStringCollection in class IPAddresspublic IPAddressPartStringCollection toStringCollection(IPAddressSection.IPStringBuilderOptions opts)
toStringCollection in class IPAddresspublic IPAddressPartStringCollection toStringCollection(IPv4AddressSection.IPv4StringBuilderOptions opts)