- java.lang.Object
-
- inet.ipaddr.Address
-
- inet.ipaddr.IPAddress
-
- inet.ipaddr.ipv6.IPv6Address
-
- All Implemented Interfaces:
AddressComponent,AddressSegmentSeries,AddressComponentRange,AddressDivisionSeries,AddressItem,AddressItemRange,IPAddressDivisionSeries,IPAddressRange,AddressStringDivisionSeries,IPAddressStringDivisionSeries,IPAddressSegmentSeries,java.io.Serializable,java.lang.Comparable<AddressItem>,java.lang.Iterable<IPv6Address>
public class IPv6Address extends IPAddress implements java.lang.Iterable<IPv6Address>
An IPv6 address, or a subnet of multiple IPv6 addresses. Each segment can represent a single value or a range of values.You can construct an IPv6 address from a byte array, from a BigInteger, from a
Address.SegmentValueProvider, from Inet6Address, from MACAddress, from anIPv6AddressSectionof 8 segments, or from an array of 8IPv6AddressSegmentobjects.To construct one from a
StringuseIPAddressString.toAddress()orIPAddressString.getAddress(),IPAddressString.toHostAddress()orIPAddressString.getHostAddress()An IPv6 address can have an associated zone, typically either a network interface name or a positive integer. An IPv6 zone distinguishes two IPv6 addresses that are the same.
- They are used with link-local addresses fe80::/10 to distinguish two interfaces to the link-local network, this is known as the zone id.
- They are used with site-local addresses to distinguish sites, using the site id, also known as the scope id.
A zone that consists of a scope id is called a scoped zone.
- Author:
- sfoley
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceIPv6Address.IPv6AddressConverterstatic classIPv6Address.IPv6ZoneA reference to a scope id by number or a network interface by name.-
Nested classes/interfaces inherited from class inet.ipaddr.IPAddress
IPAddress.DualIPv4Pv6Arrays, IPAddress.IPAddressValueProvider, IPAddress.IPVersion
-
Nested classes/interfaces inherited from class inet.ipaddr.Address
Address.AddressValueProvider, Address.SegmentValueProvider
-
-
Field Summary
Fields Modifier and Type Field Description static charALTERNATIVE_ZONE_SEPARATORstatic intBASE_85_RADIXstatic intBIT_COUNTstatic intBITS_PER_SEGMENTstatic intBYTE_COUNTstatic intBYTES_PER_SEGMENTstatic intDEFAULT_TEXTUAL_RADIXstatic intMAX_VALUE_PER_SEGMENTstatic intMIXED_ORIGINAL_SEGMENT_COUNTstatic intMIXED_REPLACED_SEGMENT_COUNTstatic java.lang.StringREVERSE_DNS_SUFFIXstatic java.lang.StringREVERSE_DNS_SUFFIX_DEPRECATEDstatic intSEGMENT_COUNTstatic charSEGMENT_SEPARATORstatic charUNC_RANGE_SEPARATORstatic java.lang.StringUNC_RANGE_SEPARATOR_STRstatic charUNC_SEGMENT_SEPARATORstatic java.lang.StringUNC_SUFFIXstatic charUNC_ZONE_SEPARATORstatic charZONE_SEPARATOR-
Fields inherited from class inet.ipaddr.IPAddress
BINARY_STR_PREFIX, DEFAULT_ADDRESS_CONVERTER, PREFIX_LEN_SEPARATOR
-
Fields inherited from class inet.ipaddr.Address
ADDRESS_HIGH_VALUE_COMPARATOR, ADDRESS_LOW_VALUE_COMPARATOR, ALTERNATIVE_RANGE_SEPARATOR, ALTERNATIVE_RANGE_SEPARATOR_STR, ALTERNATIVE_SEGMENT_WILDCARD_STR, DEFAULT_ADDRESS_COMPARATOR, HEX_PREFIX, OCTAL_PREFIX, 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 Summary
Constructors Constructor Description IPv6Address(byte[] bytes)Constructs an IPv6 address.IPv6Address(byte[] bytes, int byteStartIndex, int byteEndIndex)Constructs an IPv6 address or subnet.IPv6Address(byte[] bytes, int byteStartIndex, int byteEndIndex, java.lang.Integer networkPrefixLength)Constructs an IPv6 address or subnet.IPv6Address(byte[] bytes, IPv6Address.IPv6Zone zone)Constructs an IPv6 address.IPv6Address(byte[] bytes, java.lang.CharSequence zone)Deprecated.IPv6Address(byte[] bytes, java.lang.Integer networkPrefixLength)Constructs an IPv6 address or subnet.IPv6Address(long highBytes, long lowBytes)Constructs an IPv6 address.IPv6Address(long highBytes, long lowBytes, IPv6Address.IPv6Zone zone)Constructs an IPv6 address.IPv6Address(long highBytes, long lowBytes, java.lang.Integer networkPrefixLength)Constructs an IPv6 address or subnet.IPv6Address(Address.SegmentValueProvider valueProvider)Constructs an IPv6 address.IPv6Address(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider)Constructs an IPv6 address or subnet.IPv6Address(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, IPv6Address.IPv6Zone zone)Constructs an IPv6 address.IPv6Address(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, java.lang.CharSequence zone)IPv6Address(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, java.lang.Integer networkPrefixLength)Constructs an IPv6 address or subnet.IPv6Address(Address.SegmentValueProvider valueProvider, java.lang.Integer networkPrefixLength)Constructs an IPv6 address.IPv6Address(IPv6Address prefix, MACAddress eui)Constructs an IPv6 address from a modified EUI-64 (Extended Unique Identifier) address section and an IPv6 address section network prefix.IPv6Address(IPv6AddressSection section)IPv6Address(IPv6AddressSection section, IPv6Address.IPv6Zone zone)Constructs an IPv6 address or subnet.IPv6Address(IPv6AddressSection section, MACAddress eui)Constructs an IPv6 address from a modified EUI-64 (Extended Unique Identifier) address section and an IPv6 address section network prefix.IPv6Address(IPv6AddressSection section, MACAddressSection eui)Constructs an IPv6 address from a modified EUI-64 (Extended Unique Identifier) address and an IPv6 address section network prefix.IPv6Address(IPv6AddressSection section, MACAddressSection eui, IPv6Address.IPv6Zone zone)Constructs an IPv6 address from a modified EUI-64 (Extended Unique Identifier) address and an IPv6 address section network prefix.IPv6Address(IPv6AddressSection section, MACAddressSection eui, java.lang.CharSequence zone)Deprecated.IPv6Address(IPv6AddressSection section, java.lang.CharSequence zone)Deprecated.IPv6Address(IPv6AddressSegment[] segments)Constructs an IPv6 address or subnet.IPv6Address(IPv6AddressSegment[] segments, IPv6Address.IPv6Zone zone)Constructs an IPv6 address or a set of addresses.IPv6Address(IPv6AddressSegment[] segments, java.lang.CharSequence zone)Deprecated.IPv6Address(IPv6AddressSegment[] segments, java.lang.Integer networkPrefixLength)Constructs an IPv6 address or a set of addresses.IPv6Address(java.math.BigInteger val)Constructs an IPv6 address.IPv6Address(java.math.BigInteger val, IPv6Address.IPv6Zone zone)Constructs an IPv6 address.IPv6Address(java.math.BigInteger val, java.lang.CharSequence zone)Deprecated.IPv6Address(java.math.BigInteger val, java.lang.Integer networkPrefixLength)Constructs an IPv6 address.IPv6Address(java.math.BigInteger val, java.lang.Integer networkPrefixLength, IPv6Address.IPv6Zone zone)Constructs an IPv6 address or subnet.IPv6Address(java.math.BigInteger val, java.lang.Integer networkPrefixLength, java.lang.CharSequence zone)Deprecated.IPv6Address(java.net.Inet6Address inet6Address)Constructs an IPv6 address.IPv6Address(java.net.Inet6Address inet6Address, java.lang.Integer networkPrefixLength)Constructs an IPv6 address.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description IPv6AddressadjustPrefixBySegment(boolean nextSegment)Increases or decreases prefix length to the next segment boundary.IPv6AddressadjustPrefixBySegment(boolean nextSegment, boolean zeroed)Increases or decreases prefix length to the next segment boundary.IPv6AddressadjustPrefixLength(int adjustment)Increases or decreases prefix length by the given increment.IPv6AddressadjustPrefixLength(int adjustment, boolean zeroed)Increases or decreases prefix length by the given increment.IPv6AddressapplyPrefixLength(int networkPrefixLength)Deprecated.IPv6AddressassignMinPrefixForBlock()Constructs an equivalent address with the smallest CIDR prefix possible (largest network), such that the range of values are a set of subnet blocks for that prefix.IPv6AddressassignPrefixForSingleBlock()Returns the equivalent CIDR address with a prefix length for which the address subnet block matches the range of values in this address.IPv6AddressbitwiseOr(IPAddress mask)Equivalent to callingIPAddress.bitwiseOr(IPAddress, boolean)with the second argument as false.IPv6AddressbitwiseOr(IPAddress mask, boolean retainPrefix)Does the bitwise disjunction with this address.IPv6AddressbitwiseOrNetwork(IPAddress mask, int networkPrefixLength)Does the bitwise disjunction with this address.java.util.Iterator<IPv6Address>blockIterator(int segmentCount)Iterates through series that can be obtained by iterating through all the upper segments up to the given segment count.AddressComponentSpliterator<IPv6Address>blockSpliterator(int segmentCount)Partitions and traverses through the individual sequential blocks created from each of the individual values up to the given segment count.java.util.stream.Stream<IPv6Address>blockStream(int segmentCount)Returns a sequential stream of the individual blocks created from each of the individual values up to the given segment count.booleancontains(Address other)Returns whether this is same type and version of the given address and whether it contains all individual addresses in the given address or subnetIPv6AddresscoverWithPrefixBlock()Returns the minimal-size prefix block that covers all the values in this series.IPv6AddresscoverWithPrefixBlock(IPAddress other)Returns the minimal-size prefix block that covers all the addresses spanning from this subnet to the given subnet.java.math.BigIntegerenumerate(Address other)Indicates where an address sits relative to the subnet ordering.java.math.BigIntegerenumerate(IPAddress other)Indicates where an address sits relative to the subnet ordering.IPv4Addressget6To4IPv4Address()Returns the second and third segments as anIPv4Address.intgetBitCount()Provides the number of bits comprising this address itemintgetByteCount()Provides the number of bytes required for this address item, rounding up if the bit count is not a multiple of 8IPv6AddressSegmentgetDivision(int index)IPv4AddressgetEmbeddedIPv4Address()Returns the embeddedIPv4Addressin the lowest (least-significant) two segments.IPv4AddressgetEmbeddedIPv4Address(int byteIndex)Produces an IPv4 address from any sequence of 4 bytes in this IPv6 address.IPv6AddressgetHostMask()Returns the host mask associated with the CIDR network prefix length of this series.IPv6AddressSectiongetHostSection()Returns the host section of the series.IPv6AddressSectiongetHostSection(int networkPrefixLength)Returns the host section of the address as indicated by the network prefix length provided.IPv4AddressNetworkgetIPv4Network()IPv6Address.IPv6ZonegetIPv6Zone()Returns the zone or scope id, consisting of a network interface name or a positive integer scope identifier.java.lang.Iterable<IPv6Address>getIterable()Useful for using an instance in a "for-each loop".IPv6AddressgetLower()If this represents a series with ranging values, returns a series representing the lower values of the range.IPv6AddressgetLowerNonZeroHost()Similar toIPAddressSegmentSeries.getLower(), but will not return a series that has a prefix length and whose host value is zero.MACAddressNetworkgetMACNetwork()IPv6AddressNetworkgetNetwork()Returns the network object for components of the same version (eg IPv4, IPv6 and MAC each have their own network object)IPv6AddressgetNetworkMask()Returns the network mask associated with the CIDR network prefix length of this series.IPv6AddressSectiongetNetworkSection()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.IPv6AddressSectiongetNetworkSection(int networkPrefixLength)Returns the network section of the series.IPv6AddressSectiongetNetworkSection(int networkPrefixLength, boolean withPrefixLength)Returns the network section of the series.IPAddressStringDivisionSeries[]getParts(IPAddressSection.IPStringBuilderOptions options)Returns all the ways of breaking this address down into segments, as selected.IPAddressStringDivisionSeries[]getParts(IPv6AddressSection.IPv6StringBuilderOptions options)IPv6AddressSectiongetSection()Returns the address as an address section comprising all segments in the address.IPv6AddressSectiongetSection(int index)Gets the subsection from the series starting from the given index The first segment is at index 0.IPv6AddressSectiongetSection(int index, int endIndex)Gets the subsection from the series starting from the given index and ending just before the give endIndex The first segment is at index 0.IPv6AddressSegmentgetSegment(int index)Returns the segment from this series at the given index.intgetSegmentCount()Returns the number of segments in this series.IPv6AddressSegment[]getSegments()Returns the segments of this series of segments as an array.IPv6AddressgetUpper()If this represents a series with ranging values, returns a series representing the upper values of the range.java.lang.StringgetZone()The zone or scope id string, which as a string is typically appended to an address with a '%', eg fe80::71a3:2b00:ddd3:753f%16 If there is no zone or scope id, returns null.inthashCode()booleanhasZone()Returns whethergetZone()returns a non-null valueIPv6Addressincrement(long increment)Returns the series from the subnet that is the given increment upwards into the subnet range, with the increment of 0 returning the first address in the range.IPv6Addressincrement(java.math.BigInteger increment)IPv6AddressincrementBoundary(long increment)If the given increment is positive, adds the value to the upper series (AddressSegmentSeries.getUpper()) in the subnet range to produce a new series.IPv6Addressintersect(IPAddress other)Produces the subnet whose addresses are found in both this and the given subnet argument, or null if no such addresses.booleanis6Over4()Whether the address is 6over4booleanis6To4()Whether the address is IPv6 to IPv4 relaybooleanisEUI64()booleanisIPv4Compatible()Whether the address is IPv4-compatiblebooleanisIPv4Convertible()Determines whether this address can be converted to IPv4.booleanisIPv4Mapped()Whether the address is IPv4-mapped ::ffff:x:x/96 indicates IPv6 address mapped to IPv4booleanisIPv4Translatable()booleanisIPv6()booleanisIPv6Convertible()Determines whether an address can be converted to IPv6, if not IPv6 already.booleanisIsatap()Whether the address is ISATAPbooleanisLinkLocal()Returns whether the address is link local, whether unicast or multicast.booleanisLocal()Returns true if the address is link local, site local, organization local, administered locally, or unspecified.booleanisLoopback()booleanisMulticast()Whether the MAC address or IP address or other form of address is multicast.booleanisSameAddress(Address other)booleanisSiteLocal()booleanisTeredo()Whether the address is TeredobooleanisUniqueLocal()booleanisWellKnownIPv4Translatable()Whether the address has the well-known prefix for IPv4 translatable addresses as in rfc 6052 and 6144java.util.Iterator<IPv6Address>iterator()Iterates through the individual address components.long[]longValues()Returns a pair of longs with the lower address value in the range of this individual address or subnet.IPv6Addressmask(IPAddress mask)Equivalent to callingIPAddress.mask(IPAddress, boolean)with the second argument as false.IPv6Addressmask(IPAddress mask, boolean retainPrefix)Applies the given mask to all addresses represented by this IPAddress.IPv6AddressmaskNetwork(IPAddress mask, int networkPrefixLength)Applies the given mask to all addresses represented by this IPAddress while also applying the given prefix length at the same time.IPv6Address[]mergeToPrefixBlocks(IPAddress... addresses)Merges this with the list of addresses to produce the smallest list of prefix blocks.IPv6Address[]mergeToSequentialBlocks(IPAddress... addresses)Merges this with the list of subnets to produce the smallest list of block subnets that are sequential.java.util.Iterator<IPv6Address>nonZeroHostIterator()Similar to the iterator, but series with a host of zero are skipped.booleanoverlaps(Address other)Returns whether this is same type and version of the given address and whether it overlaps with the individual addresses in the given address or subnet, containing at least one individual address common to both.java.util.Iterator<IPv6Address>prefixBlockIterator()Iterates through the individual prefix blocks.java.util.Iterator<IPv6Address>prefixBlockIterator(int prefixLength)Iterates through the range of prefix blocks in this range instance using the given prefix length.AddressComponentSpliterator<IPv6Address>prefixBlockSpliterator()Partitions and traverses through the individual prefix blocks for the prefix length of this series.AddressComponentSpliterator<IPv6Address>prefixBlockSpliterator(int prefixLength)Partitions and traverses through the individual prefix blocks for the given prefix length.java.util.stream.Stream<IPv6Address>prefixBlockStream()Returns a sequential stream of the individual prefix blocks for the prefix length of this series.java.util.stream.Stream<IPv6Address>prefixBlockStream(int prefixLength)Returns a sequential stream of the prefix blocks for the given prefix length.java.util.Iterator<IPv6Address>prefixIterator()Iterates through the individual prefixes.java.util.Iterator<IPv6Address>prefixIterator(int prefixLength)Iterates through the range of prefixes in this range instance using the given prefix length.AddressComponentSpliterator<IPv6Address>prefixSpliterator()Partitions and traverses through the individual prefixes for the prefix length of this series.AddressComponentSpliterator<IPv6Address>prefixSpliterator(int prefixLength)Partitions and traverses through the individual prefixes for the given prefix length.java.util.stream.Stream<IPv6Address>prefixStream()Returns a sequential stream of the individual prefixes for the prefix length of this series.java.util.stream.Stream<IPv6Address>prefixStream(int prefixLength)Returns a sequential stream of the individual prefixes for the given prefix length.IPv6AddressremovePrefixLength()Deprecated.IPv6AddressremovePrefixLength(boolean zeroed)Deprecated.IPv6AddressremoveZone()Returns the equivalent address but with no zone.IPv6Addressreplace(int startIndex, int endIndex, IPv6Address replacement, int replacementIndex)Replaces segments starting from startIndex and ending before endIndex with the same number of segments starting at replacementStartIndex from the replacement sectionIPv6Addressreplace(int startIndex, IPv6AddressSection replacement)Replaces segments starting from startIndex with as many segments as possible from the replacement sectionIPv6AddressreverseBits(boolean perByte)Returns a new segment series with the bits reversed.IPv6AddressreverseBytes()Returns a new segment series with the bytes reversed.IPv6AddressreverseBytesPerSegment()Returns a new segment series with the bytes reversed within each segment.IPv6AddressreverseSegments()Returns a new segment series with the segments reversed.java.util.Iterator<IPv6AddressSegment[]>segmentsIterator()Iterates through the individual segments.java.util.Iterator<IPv6AddressSegment[]>segmentsNonZeroHostIterator()Similar to the segments iterator, but series with a host of zero are skipped.AddressComponentRangeSpliterator<IPv6Address,IPv6AddressSegment[]>segmentsSpliterator()Partitions and traverses through the individual segment arrays.java.util.stream.Stream<IPv6AddressSegment[]>segmentsStream()Returns a sequential stream of the individual segment arrays.java.util.Iterator<IPv6Address>sequentialBlockIterator()Iterates through the sequential series that make up this series.AddressComponentSpliterator<IPv6Address>sequentialBlockSpliterator()Partitions and traverses through the individual sequential blocks.java.util.stream.Stream<IPv6Address>sequentialBlockStream()Returns a sequential stream of the individual sequential blocks.IPv6AddresssetPrefixLength(int prefixLength)Sets the prefix length.IPv6AddresssetPrefixLength(int prefixLength, boolean zeroed)Sets the prefix length.IPv6AddresssetPrefixLength(int prefixLength, boolean zeroed, boolean zeroHostIsBlock)Sets the prefix length while allowing the caller to control whether bits moved in or out of the prefix become zero, and whether a zero host for the new prefix bits can be translated into a prefix block.IPv6AddresssetZone(IPv6Address.IPv6Zone newZone)Returns a new address with the same address values but with the supplied zone.IPv6Address[]spanWithPrefixBlocks()Produces an array of prefix blocks that cover the same set of addresses as this.IPv6Address[]spanWithPrefixBlocks(IPAddress other)Produces the list of prefix block subnets that span from this subnet to the given subnet.IPv6AddressSeqRangespanWithRange(IPAddress other)Produces an IPAddressRange instance that spans this subnet to the given subnet.IPv6Address[]spanWithSequentialBlocks()Produces an array of blocks that are sequential that cover the same set of addresses as this.IPv6Address[]spanWithSequentialBlocks(IPAddress other)Produces a list of sequential block subnets that span all values from this subnet to the given subnet.AddressComponentSpliterator<IPv6Address>spliterator()Partitions and traverses through the individual address components.java.util.stream.Stream<IPv6Address>stream()Returns a sequential stream of the individual address components.IPv6Address[]subtract(IPAddress other)Subtract the given subnet from this subnet, returning an array of subnets for the result (the subnets will not be contiguous so an array is required).IPAddressPartStringCollectiontoAllStringCollection()java.lang.StringtoBase85String()The base 85 string is described by RFC 1924java.lang.StringtoBinaryString()Writes this address as a single binary value with always the exact same number of charactersjava.lang.StringtoCanonicalString()This produces a canonical string.java.lang.StringtoCanonicalWildcardString()This produces a string similar to the canonical string but avoids the CIDR prefix.java.lang.StringtoCompressedString()This compresses the maximum number of zeros and/or host segments with the IPv6 compression notation '::'java.lang.StringtoCompressedWildcardString()This is similar to toNormalizedWildcardString, avoiding the CIDR prefix, but with compression as well.java.lang.StringtoConvertedString()Returns a mixed string if it represents a convertible IPv4 address, returns the normalized string otherwise.MACAddresstoEUI(boolean extended)java.lang.StringtoFullString()This produces a string with no compressed segments and all segments of full length, which is 4 characters for IPv6 segments and 3 characters for IPv4 segments.java.lang.StringtoHexString(boolean with0xPrefix)Writes this address as a single hexadecimal value with always the exact same number of characters, with or without a preceding 0x prefix.java.net.Inet6AddresstoInetAddress()Converts the lowest value of this address and the associated zone to an Inet6Address.IPv4AddresstoIPv4()If this address is IPv4 convertible, returns that address.IPv6AddresstoIPv6()IPv4AddressSectiontoMappedIPv4Segments()::ffff:x:x/96 indicates IPv6 address mapped to IPv4IPv6AddresstoMaxHost()Returns the segment series with a host of all ones.IPv6AddresstoMaxHost(int prefixLength)Produces the series with host values of all one bits for the given prefix length.java.lang.StringtoMixedString()Produces a string in which the lower 4 bytes are expressed as an IPv4 address and the remaining upper bytes are expressed in IPv6 format.java.lang.StringtoNormalizedString()The normalized string returned by this method is consistent with java.net.Inet6address.java.lang.StringtoNormalizedString(boolean keepMixed, IPv6AddressSection.IPv6StringOptions params)Constructs a string representing this address according to the given parametersjava.lang.StringtoNormalizedString(IPAddressSection.IPStringOptions params)Constructs a string representing this address according to the given parametersstatic java.lang.StringtoNormalizedString(IPv6AddressNetwork network, Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, java.lang.Integer prefixLength, java.lang.CharSequence zone)Creates the normalized string for an address without having to create the address objects first.java.lang.StringtoNormalizedString(IPv6AddressSection.IPv6StringOptions params)java.lang.StringtoNormalizedWildcardString()This produces a string similar to the normalized string but avoids the CIDR prefix.java.lang.StringtoOctalString(boolean with0Prefix)Writes this address as a single octal value with always the exact same number of characters, with or without a preceding 0 prefix.IPv6AddresstoPrefixBlock()Returns the subnet associated with the prefix length of this address.IPv6AddresstoPrefixBlock(int networkPrefixLength)Returns the segment series of the same length that spans all hosts.java.lang.StringtoPrefixLengthString()Returns a string with a CIDR network prefix length if this address has a network prefix length.java.lang.StringtoSegmentedBinaryString()Writes this IP address segment series as a segments of binary values preceded by the "0b" prefix.IPv6AddressSeqRangetoSequentialRange()Creates a sequential range instance from the lowest and highest addresses in this subnetIPv6AddressSeqRangetoSequentialRange(IPAddress other)Deprecated.java.lang.StringtoSQLWildcardString()This is the same as the string from toNormalizedWildcardString except that it usesAddress.SEGMENT_SQL_WILDCARDinstead ofAddress.SEGMENT_WILDCARDand also usesAddress.SEGMENT_SQL_SINGLE_WILDCARDIPAddressPartStringCollectiontoStandardStringCollection()IPAddressPartStringCollectiontoStringCollection(IPAddressSection.IPStringBuilderOptions opts)IPAddressPartStringCollectiontoStringCollection(IPv6AddressSection.IPv6StringBuilderOptions opts)java.lang.StringtoSubnetString()Produces a consistent subnet string that looks like 1.2.*.* or 1:2::/16 In the case of IPv4, this means that wildcards are used instead of a network prefix when a network prefix has been supplied.java.lang.StringtoUNCHostName()Generates the Microsoft UNC path component for this addressjava.net.Inet6AddresstoUpperInetAddress()Converts the highest value of this address to an InetAddress.IPv6AddresstoZeroHost()Returns the segment series with a host of zero, the host being the bits following the prefix length.IPv6AddresstoZeroHost(int prefixLength)Produces the series with host values of 0 for the given prefix length.IPv6AddresstoZeroNetwork()Returns the segment series with a network of zero, the network being the bits within the prefix length.long[]upperLongValues()Returns a pair of longs with the upper address value in the range of this individual address or subnet.IPv6AddresswithoutPrefixLength()Provides the same address with no prefix.-
Methods inherited from class inet.ipaddr.IPAddress
applyToBounds, contains, contains, containsNonZeroHosts, getBitCount, getBitsPerSegment, getBlockMaskPrefixLength, getByteCount, getBytesPerSegment, getIPVersion, getLeadingBitCount, getMatchesSQLClause, getMatchesSQLClause, getMaxSegmentValue, getNetworkPrefixLength, getNonZeroHostCount, getSegmentCount, getSequentialBlockCount, getTrailingBitCount, includesMaxHost, includesMaxHost, includesZeroHost, includesZeroHost, isAnyLocal, isIPAddress, isIPv4, isSingleNetwork, isUnspecified, isZeroHost, isZeroHost, matches, matchesWithMask, mergeToDualPrefixBlocks, mergeToDualSequentialBlocks, overlaps, overlaps, prefixContains, removeBitCountPrefixLength, toAddressString, toAllStrings, toCanonicalHostName, toDelimitedSQLStrs, toHostName, toIPAddress, toNormalizedString, toNormalizedString, toReverseDNSLookupString, toStandardStrings, toStrings
-
Methods inherited from class inet.ipaddr.Address
containsPrefixBlock, containsSinglePrefixBlock, defaultIpv4Network, defaultIpv6Network, defaultMACNetwork, equals, getBlockCount, getBytes, getBytes, getBytes, getCount, getDivisionCount, getDivisionStrings, getMinPrefixLengthForBlock, getPrefixCount, getPrefixCount, getPrefixLength, getPrefixLengthForSingleBlock, getSegments, getSegments, getSegmentStrings, getUpperBytes, getUpperBytes, getUpperBytes, getUpperValue, getValue, includesMax, includesZero, isFullRange, isMACAddress, isMax, isMultiple, isPrefixBlock, isPrefixed, isSequential, isSinglePrefixBlock, isZero, matchOrdered, matchUnordered, prefixEquals, toMACAddress, toString
-
Methods inherited from interface inet.ipaddr.format.AddressDivisionSeries
getBlockCount, getCount, getDivisionStrings, getPrefixCount, getPrefixCount, getPrefixLength, getSequentialBlockIndex, isMore, isPrefixBlock, isPrefixed, isSequential, isSinglePrefixBlock
-
Methods inherited from interface inet.ipaddr.format.AddressItem
compareTo, containsPrefixBlock, containsSinglePrefixBlock, getBytes, getBytes, getBytes, getMinPrefixLengthForBlock, getPrefixLengthForSingleBlock, getUpperBytes, getUpperBytes, getUpperBytes, getUpperValue, getValue, includesMax, includesZero, isFullRange, isMax, isMultiple, isZero
-
Methods inherited from interface inet.ipaddr.AddressSegmentSeries
getSegments, getSegments, getSegmentStrings, isOneBit, testBit
-
Methods inherited from interface inet.ipaddr.format.string.AddressStringDivisionSeries
getDivisionCount
-
Methods inherited from interface inet.ipaddr.format.IPAddressRange
isSequential
-
Methods inherited from interface inet.ipaddr.format.string.IPAddressStringDivisionSeries
getPrefixLength, isPrefixBlock, isPrefixed
-
-
-
-
Field Detail
-
SEGMENT_SEPARATOR
public static final char SEGMENT_SEPARATOR
- See Also:
- Constant Field Values
-
ZONE_SEPARATOR
public static final char ZONE_SEPARATOR
- See Also:
- Constant Field Values
-
ALTERNATIVE_ZONE_SEPARATOR
public static final char ALTERNATIVE_ZONE_SEPARATOR
- See Also:
- Constant Field Values
-
UNC_SEGMENT_SEPARATOR
public static final char UNC_SEGMENT_SEPARATOR
- See Also:
- Constant Field Values
-
UNC_ZONE_SEPARATOR
public static final char UNC_ZONE_SEPARATOR
- See Also:
- Constant Field Values
-
UNC_RANGE_SEPARATOR
public static final char UNC_RANGE_SEPARATOR
- See Also:
- Constant Field Values
-
UNC_RANGE_SEPARATOR_STR
public static final java.lang.String UNC_RANGE_SEPARATOR_STR
-
UNC_SUFFIX
public static final java.lang.String UNC_SUFFIX
- See Also:
- Constant Field Values
-
REVERSE_DNS_SUFFIX
public static final java.lang.String REVERSE_DNS_SUFFIX
- See Also:
- Constant Field Values
-
REVERSE_DNS_SUFFIX_DEPRECATED
public static final java.lang.String REVERSE_DNS_SUFFIX_DEPRECATED
- See Also:
- Constant Field Values
-
BITS_PER_SEGMENT
public static final int BITS_PER_SEGMENT
- See Also:
- Constant Field Values
-
BYTES_PER_SEGMENT
public static final int BYTES_PER_SEGMENT
- See Also:
- Constant Field Values
-
SEGMENT_COUNT
public static final int SEGMENT_COUNT
- See Also:
- Constant Field Values
-
MIXED_REPLACED_SEGMENT_COUNT
public static final int MIXED_REPLACED_SEGMENT_COUNT
- See Also:
- Constant Field Values
-
MIXED_ORIGINAL_SEGMENT_COUNT
public static final int MIXED_ORIGINAL_SEGMENT_COUNT
- See Also:
- Constant Field Values
-
BYTE_COUNT
public static final int BYTE_COUNT
- See Also:
- Constant Field Values
-
BIT_COUNT
public static final int BIT_COUNT
- See Also:
- Constant Field Values
-
DEFAULT_TEXTUAL_RADIX
public static final int DEFAULT_TEXTUAL_RADIX
- See Also:
- Constant Field Values
-
BASE_85_RADIX
public static final int BASE_85_RADIX
- See Also:
- Constant Field Values
-
MAX_VALUE_PER_SEGMENT
public static final int MAX_VALUE_PER_SEGMENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
IPv6Address
public IPv6Address(IPv6AddressSection section, IPv6Address.IPv6Zone zone) throws AddressValueException
Constructs an IPv6 address or subnet.- Parameters:
section-zone-- Throws:
AddressValueException- if segment count is not 8 or zone is invalid
-
IPv6Address
@Deprecated public IPv6Address(IPv6AddressSection section, java.lang.CharSequence zone) throws AddressValueException
Deprecated.- Parameters:
section-zone-- Throws:
AddressValueException- if segment count is not 8 or zone is invalid
-
IPv6Address
public IPv6Address(IPv6AddressSection section) throws AddressValueException
- Throws:
AddressValueException
-
IPv6Address
public IPv6Address(IPv6AddressSegment[] segments) throws AddressValueException
Constructs an IPv6 address or subnet.- Parameters:
segments- the address segments- Throws:
AddressValueException- if segment count is not 8
-
IPv6Address
public IPv6Address(IPv6AddressSegment[] segments, java.lang.Integer networkPrefixLength) throws AddressValueException
Constructs an IPv6 address or a set of addresses.- Parameters:
segments- the address segmentsnetworkPrefixLength-- Throws:
AddressValueException- if segment count is not 8AddressValueException- if network prefix length invalid
-
IPv6Address
@Deprecated public IPv6Address(IPv6AddressSegment[] segments, java.lang.CharSequence zone) throws AddressValueException
Deprecated.Constructs an IPv6 address or a set of addresses.- Parameters:
segments- the address segmentszone- the zone or scope id- Throws:
AddressValueException- if segment count is not 8 or the zone invalid
-
IPv6Address
public IPv6Address(IPv6AddressSegment[] segments, IPv6Address.IPv6Zone zone) throws AddressValueException
Constructs an IPv6 address or a set of addresses.- Parameters:
segments- the address segmentszone- the zone or scope id- Throws:
AddressValueException- if segment count is not 8 or the zone invalid
-
IPv6Address
public IPv6Address(java.net.Inet6Address inet6Address)
Constructs an IPv6 address.- Parameters:
inet6Address- the java.net address object
-
IPv6Address
public IPv6Address(java.net.Inet6Address inet6Address, java.lang.Integer networkPrefixLength)Constructs an IPv6 address.- Parameters:
inet6Address- the java.net address object
-
IPv6Address
@Deprecated public IPv6Address(byte[] bytes, java.lang.CharSequence zone) throws AddressValueExceptionDeprecated.Constructs an IPv6 address.The byte array can be a 16 byte IPv6 address, but may have additional zero-valued bytes, or it may be fewer than 16 bytes.
- Parameters:
bytes- the 16 byte IPv6 address in network byte order - if longer than 16 bytes the additional bytes must be zero (and are ignored), if shorter than 16 bytes then the bytes are sign-extended to 16 bytes.- Throws:
AddressValueException- if bytes not equivalent to a 16 byte addressAddressValueException- if byte range invalid or zone invalid
-
IPv6Address
public IPv6Address(byte[] bytes, IPv6Address.IPv6Zone zone) throws AddressValueExceptionConstructs an IPv6 address.The byte array can be a 16 byte IPv6 address, but may have additional zero-valued bytes, or it may be fewer than 16 bytes.
- Parameters:
bytes- the 16 byte IPv6 address in network byte order - if longer than 16 bytes the additional bytes must be zero (and are ignored), if shorter than 16 bytes then the bytes are sign-extended to 16 bytes.- Throws:
AddressValueException- if bytes not equivalent to a 16 byte addressAddressValueException- if byte range invalid or zone invalid
-
IPv6Address
public IPv6Address(byte[] bytes) throws AddressValueExceptionConstructs an IPv6 address.The byte array can be a 16 byte IPv6 address, but may have additional zero-valued bytes, or it may be fewer than 16 bytes.
- Parameters:
bytes- the 16 byte IPv6 address in network byte order - if longer than 16 bytes the additional bytes must be zero (and are ignored), if shorter than 16 bytes then the bytes are sign-extended to 16 bytes.- Throws:
AddressValueException- if bytes not equivalent to a 16 byte address
-
IPv6Address
public IPv6Address(byte[] bytes, int byteStartIndex, int byteEndIndex) throws AddressValueExceptionConstructs an IPv6 address or subnet.Similar to
IPv6Address(byte[])except that you can specify the start and end of the address in the given byte array.- Throws:
AddressValueException- if byte range invalid
-
IPv6Address
public IPv6Address(byte[] bytes, java.lang.Integer networkPrefixLength) throws AddressValueExceptionConstructs an IPv6 address or subnet.The byte array can be a 16 byte IPv6 address, but may have additional zero-valued bytes, or it may be fewer than 16 bytes.
When networkPrefixLength is non-null, depending on the prefix configuration (see
AddressNetwork.getPrefixConfiguration(), this object may represent either a single address with that network prefix length, or the prefix subnet block containing all addresses with the same network prefix.- Parameters:
bytes- the 16 byte IPv6 address in network byte order - if longer than 16 bytes the additional bytes must be zero (and are ignored), if shorter than 16 bytes then the bytes are sign-extended to 16 bytes.networkPrefixLength- the CIDR prefix, which can be null for no prefix length- Throws:
AddressValueException- if bytes not equivalent to a 16 byte address
-
IPv6Address
public IPv6Address(byte[] bytes, int byteStartIndex, int byteEndIndex, java.lang.Integer networkPrefixLength) throws AddressValueExceptionConstructs an IPv6 address or subnet.Similar to
IPv6Address(byte[], Integer)except that you can specify the start and end of the address in the given byte array.- Throws:
AddressValueException
-
IPv6Address
public IPv6Address(java.math.BigInteger val) throws AddressValueExceptionConstructs an IPv6 address.The byte representation from
BigInteger.toByteArray()is used, and the byte array follows the rules according toIPv6Address(byte[]). Either it must be exactly 16 bytes, or if larger then any extra bytes must be significant leading zeros, or if smaller it is sign-extended to the required 16 byte length.This means that you can end up with the same address from two different values of BigInteger, one positive and one negative. For instance, -1 and ffffffffffffffffffffffffffffffff are represented by the two's complement byte arrays [ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff] and [0,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff] respectively. Both create the address ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
In fact, the two's complement byte array [ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff,ff] can be shortened to [ff], the former being the sign-extension of the latter. So the byte array [ff] also creates the address ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff.
When using positive integers you end up with the results you expect, the magnitude of the big integer becomes the address.
When ranging over all 16-byte arrays and constructing BigInteger from those arrays, you range over all possible addresses.
- Parameters:
val- must be an IPv6 address value.- Throws:
AddressValueException- if value is outside the range of potential valuesAddressValueException- if val is invalid
-
IPv6Address
public IPv6Address(java.math.BigInteger val, java.lang.Integer networkPrefixLength) throws AddressValueExceptionConstructs an IPv6 address.The byte representation from
BigInteger.toByteArray()is used, and the byte array follows the rules according toIPv6Address(byte[]). Either it must be exactly 16 bytes, or if larger then any extra bytes must be significant leading zeros, or if smaller it is sign-extended to the required 16 byte length.When networkPrefixLength is non-null, depending on the prefix configuration (see
AddressNetwork.getPrefixConfiguration(), this object may represent either a single address with that network prefix length, or the prefix subnet block containing all addresses with the same network prefix.- Parameters:
val-networkPrefixLength-- Throws:
AddressValueException- if val is invalid
-
IPv6Address
@Deprecated public IPv6Address(java.math.BigInteger val, java.lang.CharSequence zone) throws AddressValueExceptionDeprecated.Constructs an IPv6 address.The byte representation from
BigInteger.toByteArray()is used, and the byte array follows the rules according toIPv6Address(byte[]). Either it must be exactly 16 bytes, or if larger then any extra bytes must be significant leading zeros, or if smaller it is sign-extended to the required 16 byte length.- Parameters:
val-zone-- Throws:
AddressValueException- if val is invalid or if zone is invalid
-
IPv6Address
public IPv6Address(java.math.BigInteger val, IPv6Address.IPv6Zone zone) throws AddressValueExceptionConstructs an IPv6 address.The byte representation from
BigInteger.toByteArray()is used, and the byte array follows the rules according toIPv6Address(byte[]). Either it must be exactly 16 bytes, or if larger then any extra bytes must be significant leading zeros, or if smaller it is sign-extended to the required 16 byte length.- Parameters:
val-zone-- Throws:
AddressValueException- if val is invalid or if zone is invalid
-
IPv6Address
@Deprecated public IPv6Address(java.math.BigInteger val, java.lang.Integer networkPrefixLength, java.lang.CharSequence zone) throws AddressValueExceptionDeprecated.Constructs an IPv6 address or subnet.When networkPrefixLength is non-null, depending on the prefix configuration (see
AddressNetwork.getPrefixConfiguration(), this object may represent either a single address with that network prefix length, or the prefix subnet block containing all addresses with the same network prefix.- Parameters:
val- must be an IPv6 address valuenetworkPrefixLength- the CIDR prefix length, which can be null for no prefix lengthzone- the zone or scope id- Throws:
AddressValueException- if value is outside the range of potential values, or if zone is invalid
-
IPv6Address
public IPv6Address(java.math.BigInteger val, java.lang.Integer networkPrefixLength, IPv6Address.IPv6Zone zone) throws AddressValueExceptionConstructs an IPv6 address or subnet.When networkPrefixLength is non-null, depending on the prefix configuration (see
AddressNetwork.getPrefixConfiguration(), this object may represent either a single address with that network prefix length, or the prefix subnet block containing all addresses with the same network prefix.- Parameters:
val- must be an IPv6 address valuenetworkPrefixLength- the CIDR prefix length, which can be null for no prefix lengthzone- the zone or scope id- Throws:
AddressValueException- if value is outside the range of potential values, or if zone is invalid
-
IPv6Address
public IPv6Address(long highBytes, long lowBytes, IPv6Address.IPv6Zone zone) throws AddressValueExceptionConstructs an IPv6 address.The highBytes form the more significant 4 bytes of the address.
- Parameters:
highBytes- the 4 more significant bytes in network byte orderlowBytes- the 4 least significant bytes in network byte order- Throws:
AddressValueException- if zone invalid
-
IPv6Address
public IPv6Address(long highBytes, long lowBytes) throws AddressValueExceptionConstructs an IPv6 address.The highBytes form the more significant 4 bytes of the address.
- Parameters:
highBytes- the 4 more significant bytes in network byte orderlowBytes- the 4 least significant bytes in network byte order- Throws:
AddressValueException
-
IPv6Address
public IPv6Address(long highBytes, long lowBytes, java.lang.Integer networkPrefixLength) throws AddressValueExceptionConstructs an IPv6 address or subnet.The highBytes form the more significant 4 bytes of the address.
When networkPrefixLength is non-null, depending on the prefix configuration (see
AddressNetwork.getPrefixConfiguration(), this object may represent either a single address with that network prefix length, or the prefix subnet block containing all addresses with the same network prefix.- Parameters:
highBytes- the 4 more significant bytes in network byte orderlowBytes- the 4 least significant bytes in network byte ordernetworkPrefixLength- the CIDR prefix, which can be null for no prefix length- Throws:
AddressValueException
-
IPv6Address
public IPv6Address(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, java.lang.Integer networkPrefixLength) throws AddressValueException
Constructs an IPv6 address or subnet.When networkPrefixLength is non-null, depending on the prefix configuration (see
AddressNetwork.getPrefixConfiguration(), this object may represent either a single address with that network prefix length, or the prefix subnet block containing all addresses with the same network prefix.- Parameters:
lowerValueProvider- supplies the 2 byte lower values for each segmentupperValueProvider- supplies the 2 byte upper values for each segmentnetworkPrefixLength- the CIDR network prefix length, which can be null for no prefix- Throws:
AddressValueException
-
IPv6Address
public IPv6Address(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider)
Constructs an IPv6 address or subnet.- Parameters:
lowerValueProvider- supplies the 2 byte lower values for each segmentupperValueProvider- supplies the 2 byte upper values for each segment
-
IPv6Address
public IPv6Address(Address.SegmentValueProvider valueProvider, java.lang.Integer networkPrefixLength) throws AddressValueException
Constructs an IPv6 address.When networkPrefixLength is non-null, depending on the prefix configuration (see
AddressNetwork.getPrefixConfiguration(), this object may represent either a single address with that network prefix length, or the prefix subnet block containing all addresses with the same network prefix.- Parameters:
valueProvider- supplies the 2 byte value for each segmentnetworkPrefixLength- the CIDR network prefix length, which can be null for no prefix- Throws:
AddressValueException
-
IPv6Address
public IPv6Address(Address.SegmentValueProvider valueProvider)
Constructs an IPv6 address.- Parameters:
valueProvider- supplies the 2 byte value for each segment
-
IPv6Address
@Deprecated public IPv6Address(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, java.lang.CharSequence zone) throws AddressValueException
Constructs an IPv6 address.- Parameters:
lowerValueProvider- supplies the 2 byte lower values for each segmentupperValueProvider- supplies the 2 byte upper values for each segment- Throws:
AddressValueException- if zone is invalid
-
IPv6Address
public IPv6Address(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, IPv6Address.IPv6Zone zone) throws AddressValueException
Constructs an IPv6 address.- Parameters:
lowerValueProvider- supplies the 2 byte lower values for each segmentupperValueProvider- supplies the 2 byte upper values for each segment- Throws:
AddressValueException- if zone is invalid
-
IPv6Address
public IPv6Address(IPv6Address prefix, MACAddress eui) throws IncompatibleAddressException
Constructs an IPv6 address from a modified EUI-64 (Extended Unique Identifier) address section and an IPv6 address section network prefix.If the supplied MAC section is an 8 byte EUI-64, then it must match the required EUI-64 format of xx-xx-ff-fe-xx-xx with the ff-fe section in the middle. If the supplied section is a 6 byte MAC-48 or EUI-48, then the ff-fe pattern will be inserted.
If the supplied section neither 6 nor 8 bytes, or if the 8-byte section does not have required EUI-64 format of xx-xx-ff-fe-xx-xx,
IncompatibleAddressExceptionwill be thrown.The constructor will toggle the MAC U/L (universal/local) bit as required with EUI-64.
Only the first 8 bytes (4 segments) of the IPv6Address are used to construct the address.
Any prefix length in the MAC address is ignored, while a prefix length in the IPv6 address is preserved but only up to the first 4 segments.
- Parameters:
prefix- an address from which the first four segments will be used as the same initial segments in the returned addresseui-- Throws:
IncompatibleAddressException- if the MACAddress is an 8 byte MAC address incompatible with EUI-64 IPv6 format
-
IPv6Address
public IPv6Address(IPv6AddressSection section, MACAddress eui) throws IncompatibleAddressException, AddressValueException
Constructs an IPv6 address from a modified EUI-64 (Extended Unique Identifier) address section and an IPv6 address section network prefix.If the supplied MAC section is an 8 byte EUI-64, then it must match the required EUI-64 format of xx-xx-ff-fe-xx-xx with the ff-fe section in the middle. If the supplied section is a 6 byte MAC-48 or EUI-48, then the ff-fe pattern will be inserted.
If the supplied section neither 6 nor 8 bytes, or if the 8-byte section does not have required EUI-64 format of xx-xx-ff-fe-xx-xx,
IncompatibleAddressExceptionwill be thrown.The constructor will toggle the MAC U/L (universal/local) bit as required with EUI-64.
The IPv6 address section must be 8 bytes.
Any prefix length in the MAC address is ignored, while a prefix length in the IPv6 address is preserved but only up to the first 4 segments.
- Parameters:
section-eui-- Throws:
IncompatibleAddressException- if the MACAddress is an 8 byte MAC address incompatible with EUI-64 IPv6 formatAddressValueException- if the IPv6 section is the wrong size or structure
-
IPv6Address
public IPv6Address(IPv6AddressSection section, MACAddressSection eui) throws IncompatibleAddressException, AddressValueException
Constructs an IPv6 address from a modified EUI-64 (Extended Unique Identifier) address and an IPv6 address section network prefix.If the supplied address is an 8 byte EUI-64, then it must match the required EUI-64 format of xx-xx-ff-fe-xx-xx with the ff-fe section in the middle. If the supplied address is a 6 byte MAC-48 or EUI-48, then the ff-fe pattern will be inserted.
The constructor will toggle the MAC U/L (universal/local) bit as required with EUI-64.
The IPv6 address section must be 8 bytes.
Any prefix length in the MAC address is ignored, while a prefix length in the IPv6 address is preserved but only up to the first 4 segments.
- Parameters:
section-eui-- Throws:
IncompatibleAddressException- if the MACAddress is an 8 byte MAC address incompatible with EUI-64 IPv6 formatAddressValueException- if the MACAddress or IPv6 sections are the wrong size or structure
-
IPv6Address
@Deprecated public IPv6Address(IPv6AddressSection section, MACAddressSection eui, java.lang.CharSequence zone) throws IncompatibleAddressException, AddressValueException
Deprecated.Constructs an IPv6 address from a modified EUI-64 (Extended Unique Identifier) address and an IPv6 address section network prefix.- Parameters:
section-eui-zone-- Throws:
IncompatibleAddressException- if the MACAddress is an 8 byte MAC address incompatible with EUI-64 IPv6 formatAddressValueException- if the MACAddress or IPv6 sections are the wrong size or structure, or if zone is invalid
-
IPv6Address
public IPv6Address(IPv6AddressSection section, MACAddressSection eui, IPv6Address.IPv6Zone zone) throws IncompatibleAddressException, AddressValueException
Constructs an IPv6 address from a modified EUI-64 (Extended Unique Identifier) address and an IPv6 address section network prefix.- Parameters:
section-eui-zone-- Throws:
IncompatibleAddressException- if the MACAddress is an 8 byte MAC address incompatible with EUI-64 IPv6 formatAddressValueException- if the MACAddress or IPv6 sections are the wrong size or structure, or if zone is invalid
-
-
Method Detail
-
getNetwork
public IPv6AddressNetwork getNetwork()
Description copied from interface:AddressComponentReturns the network object for components of the same version (eg IPv4, IPv6 and MAC each have their own network object)- Specified by:
getNetworkin interfaceAddressComponent- Specified by:
getNetworkin interfaceIPAddressSegmentSeries- Specified by:
getNetworkin interfaceIPAddressStringDivisionSeries- Specified by:
getNetworkin classIPAddress- Returns:
-
getMACNetwork
public MACAddressNetwork getMACNetwork()
-
getIPv4Network
public IPv4AddressNetwork getIPv4Network()
-
getSection
public IPv6AddressSection getSection()
Description copied from class:IPAddressReturns the address as an address section comprising all segments in the address.- Specified by:
getSectionin interfaceAddressSegmentSeries- Specified by:
getSectionin interfaceIPAddressSegmentSeries- Overrides:
getSectionin classIPAddress- Returns:
-
getSection
public IPv6AddressSection getSection(int index)
Description copied from interface:AddressSegmentSeriesGets the subsection from the series starting from the given index The first segment is at index 0.- Specified by:
getSectionin interfaceAddressSegmentSeries- Specified by:
getSectionin interfaceIPAddressSegmentSeries- Overrides:
getSectionin classIPAddress- Returns:
-
getSection
public IPv6AddressSection getSection(int index, int endIndex)
Description copied from interface:AddressSegmentSeriesGets the subsection from the series starting from the given index and ending just before the give endIndex The first segment is at index 0.- Specified by:
getSectionin interfaceAddressSegmentSeries- Specified by:
getSectionin interfaceIPAddressSegmentSeries- Overrides:
getSectionin classIPAddress- Returns:
-
getDivision
public IPv6AddressSegment getDivision(int index)
- Specified by:
getDivisionin interfaceAddressDivisionSeries- Specified by:
getDivisionin interfaceAddressStringDivisionSeries- Specified by:
getDivisionin interfaceIPAddressDivisionSeries- Specified by:
getDivisionin interfaceIPAddressStringDivisionSeries- Returns:
- the given division in this series. The first is at index 0.
-
getSegment
public IPv6AddressSegment getSegment(int index)
Description copied from interface:AddressSegmentSeriesReturns the segment from this series at the given index. The first segment is at index 0. A segment is an address division, seeAddressDivisionSeries.getDivision(int), the difference being that all segments in a given series are the same bit count, while divisions can have variable length.- Specified by:
getSegmentin interfaceAddressSegmentSeries- Specified by:
getSegmentin interfaceIPAddressSegmentSeries- Returns:
-
getSegments
public IPv6AddressSegment[] getSegments()
Description copied from interface:AddressSegmentSeriesReturns the segments of this series of segments as an array. This must create a new array, so for efficiency useAddressSegmentSeries.getSegment(int)andAddressSegmentSeries.getSegmentCount()instead when feasible.- Specified by:
getSegmentsin interfaceAddressSegmentSeries- Specified by:
getSegmentsin interfaceIPAddressSegmentSeries- Returns:
-
isEUI64
public boolean isEUI64()
-
toEUI
public MACAddress toEUI(boolean extended)
-
getParts
public IPAddressStringDivisionSeries[] getParts(IPAddressSection.IPStringBuilderOptions options)
Description copied from class:IPAddressReturns all the ways of breaking this address down into segments, as selected.
-
getParts
public IPAddressStringDivisionSeries[] getParts(IPv6AddressSection.IPv6StringBuilderOptions options)
-
getSegmentCount
public int getSegmentCount()
Description copied from interface:AddressSegmentSeriesReturns the number of segments in this series.- Specified by:
getSegmentCountin interfaceAddressSegmentSeries- Overrides:
getSegmentCountin classAddress- Returns:
-
getByteCount
public int getByteCount()
Description copied from interface:AddressItemProvides the number of bytes required for this address item, rounding up if the bit count is not a multiple of 8- Specified by:
getByteCountin interfaceAddressItem- Overrides:
getByteCountin classIPAddress- Returns:
- the number of bytes
-
getBitCount
public int getBitCount()
Description copied from interface:AddressItemProvides the number of bits comprising this address item- Specified by:
getBitCountin interfaceAddressDivisionSeries- Specified by:
getBitCountin interfaceAddressItem- Overrides:
getBitCountin classAddress- Returns:
- the number of bits
-
getLowerNonZeroHost
public IPv6Address getLowerNonZeroHost()
Description copied from interface:IPAddressSegmentSeriesSimilar toIPAddressSegmentSeries.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 asIPAddressSegmentSeries.getLower().- Specified by:
getLowerNonZeroHostin interfaceIPAddressSegmentSeries- Specified by:
getLowerNonZeroHostin classIPAddress- Returns:
- the lowest IP address series whose host is non-zero, or null if no such address section exists.
-
getLower
public IPv6Address getLower()
Description copied from interface:AddressSegmentSeriesIf this represents a series with ranging values, returns a series representing the lower values of the range. If this represents an series with a single value in each segment, returns this.- Specified by:
getLowerin interfaceAddressComponentRange- Specified by:
getLowerin interfaceAddressSegmentSeries- Specified by:
getLowerin interfaceIPAddressRange- Specified by:
getLowerin interfaceIPAddressSegmentSeries- Specified by:
getLowerin classIPAddress- Returns:
-
getUpper
public IPv6Address getUpper()
Description copied from interface:AddressSegmentSeriesIf 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.- Specified by:
getUpperin interfaceAddressComponentRange- Specified by:
getUpperin interfaceAddressSegmentSeries- Specified by:
getUpperin interfaceIPAddressRange- Specified by:
getUpperin interfaceIPAddressSegmentSeries- Specified by:
getUpperin classIPAddress- Returns:
-
longValues
public long[] longValues()
Returns a pair of longs with the lower address value in the range of this individual address or subnet. The high bits are in the first element, the low bits in the second.- Returns:
-
upperLongValues
public long[] upperLongValues()
Returns a pair of longs with the upper address value in the range of this individual address or subnet. The high bits are in the first element, the low bits in the second.- Returns:
-
replace
public IPv6Address replace(int startIndex, int endIndex, IPv6Address replacement, int replacementIndex)
Replaces segments starting from startIndex and ending before endIndex with the same number of segments starting at replacementStartIndex from the replacement section- Parameters:
startIndex-endIndex-replacement-replacementIndex-- Returns:
- Throws:
java.lang.IndexOutOfBoundsException
-
replace
public IPv6Address replace(int startIndex, IPv6AddressSection replacement)
Replaces segments starting from startIndex with as many segments as possible from the replacement section- Parameters:
startIndex-replacement-- Returns:
- Throws:
java.lang.IndexOutOfBoundsException
-
reverseBits
public IPv6Address reverseBits(boolean perByte)
Description copied from interface:AddressSegmentSeriesReturns a new segment series with the bits reversed.- Specified by:
reverseBitsin interfaceAddressComponent- Specified by:
reverseBitsin interfaceAddressSegmentSeries- Specified by:
reverseBitsin interfaceIPAddressSegmentSeries- Specified by:
reverseBitsin classIPAddress- Parameters:
perByte- if true, only the bits in each byte are reversed, if false, then all bits in the component are reversed- Returns:
-
reverseBytes
public IPv6Address reverseBytes()
Description copied from interface:AddressSegmentSeriesReturns a new segment series with the bytes reversed.- Specified by:
reverseBytesin interfaceAddressComponent- Specified by:
reverseBytesin interfaceAddressSegmentSeries- Specified by:
reverseBytesin interfaceIPAddressSegmentSeries- Specified by:
reverseBytesin classIPAddress- Returns:
-
reverseBytesPerSegment
public IPv6Address reverseBytesPerSegment()
Description copied from interface:AddressSegmentSeriesReturns a new segment series with the bytes reversed within each segment.- Specified by:
reverseBytesPerSegmentin interfaceAddressSegmentSeries- Specified by:
reverseBytesPerSegmentin interfaceIPAddressSegmentSeries- Specified by:
reverseBytesPerSegmentin classIPAddress- Returns:
-
reverseSegments
public IPv6Address reverseSegments()
Description copied from interface:AddressSegmentSeriesReturns a new segment series with the segments reversed. This does not throwIncompatibleAddressExceptionsince all address series can reverse their segments.- Specified by:
reverseSegmentsin interfaceAddressSegmentSeries- Specified by:
reverseSegmentsin interfaceIPAddressSegmentSeries- Specified by:
reverseSegmentsin classIPAddress- Returns:
-
segmentsNonZeroHostIterator
public java.util.Iterator<IPv6AddressSegment[]> segmentsNonZeroHostIterator()
Description copied from interface:IPAddressSegmentSeriesSimilar to the segments iterator, but series with a host of zero are skipped.- Specified by:
segmentsNonZeroHostIteratorin interfaceIPAddressSegmentSeries- Returns:
-
segmentsIterator
public java.util.Iterator<IPv6AddressSegment[]> segmentsIterator()
Description copied from interface:AddressSegmentSeriesIterates through the individual segments.- Specified by:
segmentsIteratorin interfaceAddressSegmentSeries- Specified by:
segmentsIteratorin interfaceIPAddressSegmentSeries
-
segmentsSpliterator
public AddressComponentRangeSpliterator<IPv6Address,IPv6AddressSegment[]> segmentsSpliterator()
Description copied from interface:AddressSegmentSeriesPartitions and traverses through the individual segment arrays.- Specified by:
segmentsSpliteratorin interfaceAddressSegmentSeries- Specified by:
segmentsSpliteratorin interfaceIPAddressSegmentSeries- Returns:
-
segmentsStream
public java.util.stream.Stream<IPv6AddressSegment[]> segmentsStream()
Description copied from interface:AddressSegmentSeriesReturns a sequential stream of the individual segment arrays. For a parallel stream, callBaseStream.parallel()on the returned stream.- Specified by:
segmentsStreamin interfaceAddressSegmentSeries- Specified by:
segmentsStreamin interfaceIPAddressSegmentSeries- Returns:
-
prefixBlockIterator
public java.util.Iterator<IPv6Address> prefixBlockIterator()
Description copied from interface:AddressSegmentSeriesIterates through the individual prefix blocks.If the series has no prefix length, then this is equivalent to
AddressSegmentSeries.iterator()- Specified by:
prefixBlockIteratorin interfaceAddressSegmentSeries- Specified by:
prefixBlockIteratorin interfaceIPAddressSegmentSeries- Specified by:
prefixBlockIteratorin classIPAddress
-
prefixBlockSpliterator
public AddressComponentSpliterator<IPv6Address> prefixBlockSpliterator()
Description copied from interface:AddressSegmentSeriesPartitions and traverses through the individual prefix blocks for the prefix length of this series.- Specified by:
prefixBlockSpliteratorin interfaceAddressSegmentSeries- Specified by:
prefixBlockSpliteratorin interfaceIPAddressSegmentSeries- Specified by:
prefixBlockSpliteratorin classIPAddress- Returns:
-
prefixBlockStream
public java.util.stream.Stream<IPv6Address> prefixBlockStream()
Description copied from interface:AddressSegmentSeriesReturns a sequential stream of the individual prefix blocks for the prefix length of this series. For a parallel stream, callBaseStream.parallel()on the returned stream.- Specified by:
prefixBlockStreamin interfaceAddressSegmentSeries- Specified by:
prefixBlockStreamin interfaceIPAddressSegmentSeries- Specified by:
prefixBlockStreamin classIPAddress- Returns:
-
prefixBlockIterator
public java.util.Iterator<IPv6Address> prefixBlockIterator(int prefixLength)
Description copied from interface:IPAddressRangeIterates through the range of prefix blocks in this range instance using the given prefix length.- Specified by:
prefixBlockIteratorin interfaceIPAddressRange- Returns:
-
prefixBlockSpliterator
public AddressComponentSpliterator<IPv6Address> prefixBlockSpliterator(int prefixLength)
Description copied from interface:IPAddressRangePartitions and traverses through the individual prefix blocks for the given prefix length.- Specified by:
prefixBlockSpliteratorin interfaceIPAddressRange- Returns:
-
prefixBlockStream
public java.util.stream.Stream<IPv6Address> prefixBlockStream(int prefixLength)
Description copied from interface:IPAddressRangeReturns a sequential stream of the prefix blocks for the given prefix length. For a parallel stream, callBaseStream.parallel()on the returned stream.- Specified by:
prefixBlockStreamin interfaceIPAddressRange- Returns:
-
prefixIterator
public java.util.Iterator<IPv6Address> prefixIterator()
Description copied from interface:AddressSegmentSeriesIterates through the individual prefixes.If the series has no prefix length, then this is equivalent to
AddressSegmentSeries.iterator()- Specified by:
prefixIteratorin interfaceAddressSegmentSeries- Specified by:
prefixIteratorin interfaceIPAddressSegmentSeries- Specified by:
prefixIteratorin classIPAddress
-
prefixSpliterator
public AddressComponentSpliterator<IPv6Address> prefixSpliterator()
Description copied from interface:AddressSegmentSeriesPartitions and traverses through the individual prefixes for the prefix length of this series.- Specified by:
prefixSpliteratorin interfaceAddressSegmentSeries- Specified by:
prefixSpliteratorin interfaceIPAddressSegmentSeries- Specified by:
prefixSpliteratorin classIPAddress- Returns:
-
prefixStream
public java.util.stream.Stream<IPv6Address> prefixStream()
Description copied from interface:AddressSegmentSeriesReturns a sequential stream of the individual prefixes for the prefix length of this series. For a parallel stream, callBaseStream.parallel()on the returned stream.- Specified by:
prefixStreamin interfaceAddressSegmentSeries- Specified by:
prefixStreamin interfaceIPAddressSegmentSeries- Specified by:
prefixStreamin classIPAddress- Returns:
-
prefixIterator
public java.util.Iterator<IPv6Address> prefixIterator(int prefixLength)
Description copied from interface:IPAddressRangeIterates through the range of prefixes in this range instance using the given prefix length.- Specified by:
prefixIteratorin interfaceIPAddressRange- Returns:
-
prefixSpliterator
public AddressComponentSpliterator<IPv6Address> prefixSpliterator(int prefixLength)
Description copied from interface:IPAddressRangePartitions and traverses through the individual prefixes for the given prefix length.- Specified by:
prefixSpliteratorin interfaceIPAddressRange- Returns:
-
prefixStream
public java.util.stream.Stream<IPv6Address> prefixStream(int prefixLength)
Description copied from interface:IPAddressRangeReturns a sequential stream of the individual prefixes for the given prefix length. For a parallel stream, callBaseStream.parallel()on the returned stream.- Specified by:
prefixStreamin interfaceIPAddressRange- Returns:
-
blockIterator
public java.util.Iterator<IPv6Address> blockIterator(int segmentCount)
Description copied from interface:IPAddressSegmentSeriesIterates through series that can be obtained by iterating through all the upper segments up to the given segment count. Segments following remain the same in all iterated series.For instance, given the IPv4 subnet 1-2.3-4.5-6.7, given the count argument 2, it will iterate through 1.3.5-6.7, 1.4.5-6.7, 2.3.5-6.7, 2.4.5-6.7
- Specified by:
blockIteratorin interfaceIPAddressSegmentSeries- Specified by:
blockIteratorin classIPAddress- Returns:
-
blockSpliterator
public AddressComponentSpliterator<IPv6Address> blockSpliterator(int segmentCount)
Description copied from interface:IPAddressSegmentSeriesPartitions and traverses through the individual sequential blocks created from each of the individual values up to the given segment count.- Specified by:
blockSpliteratorin interfaceIPAddressSegmentSeries- Specified by:
blockSpliteratorin classIPAddress- Returns:
-
blockStream
public java.util.stream.Stream<IPv6Address> blockStream(int segmentCount)
Description copied from interface:IPAddressSegmentSeriesReturns a sequential stream of the individual blocks created from each of the individual values up to the given segment count. For a parallel stream, callBaseStream.parallel()on the returned stream.- Specified by:
blockStreamin interfaceIPAddressSegmentSeries- Specified by:
blockStreamin classIPAddress- Returns:
-
sequentialBlockIterator
public java.util.Iterator<IPv6Address> sequentialBlockIterator()
Description copied from interface:IPAddressSegmentSeriesIterates through the sequential series that make up this series. Generally this means finding the count of segments for which the segments that follow are not full range, and then usingIPAddressSegmentSeries.blockIterator(int)with that segment count.For instance, given the IPv4 subnet 1-2.3-4.5-6.7-8, it will iterate through 1.3.5.7-8, 1.3.6.7-8, 1.4.5.7-8, 1.4.6.7-8, 2.3.5.7-8, 2.3.6.7-8, 2.4.6.7-8, 2.4.6.7-8.
Use
IPAddressSegmentSeries.getSequentialBlockCount()to get the count of iterated elements.- Specified by:
sequentialBlockIteratorin interfaceIPAddressSegmentSeries- Overrides:
sequentialBlockIteratorin classIPAddress- Returns:
-
sequentialBlockSpliterator
public AddressComponentSpliterator<IPv6Address> sequentialBlockSpliterator()
Description copied from interface:IPAddressSegmentSeriesPartitions and traverses through the individual sequential blocks.- Specified by:
sequentialBlockSpliteratorin interfaceIPAddressSegmentSeries- Overrides:
sequentialBlockSpliteratorin classIPAddress- Returns:
-
sequentialBlockStream
public java.util.stream.Stream<IPv6Address> sequentialBlockStream()
Description copied from interface:IPAddressSegmentSeriesReturns a sequential stream of the individual sequential blocks. For a parallel stream, callBaseStream.parallel()on the returned stream.Use
IPAddressSegmentSeries.getSequentialBlockCount()to get the count of streamed elements.- Specified by:
sequentialBlockStreamin interfaceIPAddressSegmentSeries- Overrides:
sequentialBlockStreamin classIPAddress- Returns:
-
iterator
public java.util.Iterator<IPv6Address> iterator()
Description copied from interface:AddressComponentRangeIterates through the individual address components.An address component can represent an individual segment, address, or section, or it can represent multiple, typically a subnet of addresses or a range of segment or section values.
Call
AddressItem.isMultiple()to determine if this instance represents multiple, orAddressItem.getCount()for the count.- Specified by:
iteratorin interfaceAddressComponentRange- Specified by:
iteratorin interfaceAddressSegmentSeries- Specified by:
iteratorin interfaceIPAddressRange- Specified by:
iteratorin interfaceIPAddressSegmentSeries- Specified by:
iteratorin interfacejava.lang.Iterable<IPv6Address>- Specified by:
iteratorin classIPAddress- Returns:
-
spliterator
public AddressComponentSpliterator<IPv6Address> spliterator()
Description copied from interface:AddressComponentRangePartitions and traverses through the individual address components.- Specified by:
spliteratorin interfaceAddressComponent- Specified by:
spliteratorin interfaceAddressComponentRange- Specified by:
spliteratorin interfaceAddressSegmentSeries- Specified by:
spliteratorin interfaceIPAddressRange- Specified by:
spliteratorin interfaceIPAddressSegmentSeries- Specified by:
spliteratorin interfacejava.lang.Iterable<IPv6Address>- Specified by:
spliteratorin classIPAddress- Returns:
-
stream
public java.util.stream.Stream<IPv6Address> stream()
Description copied from interface:AddressComponentRangeReturns a sequential stream of the individual address components. For a parallel stream, callBaseStream.parallel()on the returned stream.- Specified by:
streamin interfaceAddressComponentRange- Specified by:
streamin interfaceAddressSegmentSeries- Specified by:
streamin interfaceIPAddressSegmentSeries- Specified by:
streamin classIPAddress- Returns:
-
nonZeroHostIterator
public java.util.Iterator<IPv6Address> nonZeroHostIterator()
Description copied from interface:IPAddressSegmentSeriesSimilar to the iterator, but series with a host of zero are skipped.- Specified by:
nonZeroHostIteratorin interfaceIPAddressSegmentSeries- Specified by:
nonZeroHostIteratorin classIPAddress- Returns:
-
getIterable
public java.lang.Iterable<IPv6Address> getIterable()
Description copied from interface:AddressComponentRangeUseful for using an instance in a "for-each loop". Otherwise just callAddressComponentRange.iterator()directly.- Specified by:
getIterablein interfaceAddressComponentRange- Specified by:
getIterablein interfaceAddressSegmentSeries- Specified by:
getIterablein interfaceIPAddressRange- Specified by:
getIterablein interfaceIPAddressSegmentSeries- Specified by:
getIterablein classIPAddress- Returns:
- an object to iterate over the individual addresses represented by this object.
-
increment
public IPv6Address increment(java.math.BigInteger increment)
-
increment
public IPv6Address increment(long increment)
Description copied from interface:AddressSegmentSeriesReturns the series from the subnet that is the given increment upwards into the subnet range, with the increment of 0 returning the first address in the range.If the subnet has multiple values and the increment exceeds the subnet size, then the amount by which it exceeds the size - 1 is added to the upper series of the range (the final iterator value).
If the increment is negative, it is added to the lower series of the range (the first iterator value).
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
AddressSegmentSeries.iterator()For instance, a increment of 0 is the first value from the iterator, an increment of 1 is the second value from the iterator, and so on. A negative increment added to the subnet count is equivalent to the same number of values preceding the upper bound of the iterator. For instance, an increment of count - 1 is the last value from the iterator, an increment of count - 2 is the second last value, and so on.An increment of size count gives you the series just above the highest series of the subnet. To get the series just below the lowest series of the subnet, use the increment -1.
- Specified by:
incrementin interfaceAddressSegmentSeries- Specified by:
incrementin interfaceIPAddressSegmentSeries- Specified by:
incrementin classIPAddress- Returns:
-
incrementBoundary
public IPv6Address incrementBoundary(long increment)
Description copied from interface:AddressSegmentSeriesIf the given increment is positive, adds the value to the upper series (AddressSegmentSeries.getUpper()) in the subnet range to produce a new series. If the given increment is negative, adds the value to the lower series (AddressSegmentSeries.getLower()) in the subnet range to produce a new series. If the increment is zero, returns this.In the case where the series is a single value, this simply returns the address produced by adding the given increment to this address series.
- Specified by:
incrementBoundaryin interfaceAddressSegmentSeries- Specified by:
incrementBoundaryin interfaceIPAddressSegmentSeries- Specified by:
incrementBoundaryin classIPAddress- Returns:
-
toIPv4
public IPv4Address toIPv4()
If this address is IPv4 convertible, returns that address. Otherwise, returns null.You can also use
isIPv4Convertible()to determine convertibility. Both use an instance ofIPAddressConverter.DefaultAddressConverterwhich uses IPv4-mapped address mappings from rfc 4038.Override this method and
isIPv4Convertible()if you wish to map IPv6 to IPv4 according to the mappings defined by inisIPv4Compatible(),isIPv4Mapped(),is6To4()or by some other mapping.For the reverse mapping, see
IPv4Address.toIPv6()- Overrides:
toIPv4in classIPAddress- Returns:
- the address
- See Also:
IPAddress.isIPv4Convertible()
-
toIPv6
public IPv6Address toIPv6()
- Overrides:
toIPv6in classIPAddress- Returns:
- If this address is IPv6, or can be converted to IPv6, returns that
IPv6Address. Otherwise, returns null. - See Also:
IPAddress.isIPv6Convertible()
-
isIPv4Convertible
public boolean isIPv4Convertible()
Determines whether this address can be converted to IPv4. Override this method to convert in your own way. The default behaviour is to use isIPv4Mapped() You should also overridetoIPv4()to match the conversion.- Specified by:
isIPv4Convertiblein classIPAddress- Returns:
-
isIPv6Convertible
public boolean isIPv6Convertible()
Description copied from class:IPAddressDetermines whether an address can be converted to IPv6, if not IPv6 already. Override this method to convert in your own way. The default behaviour is to convert by IPv4 mapping, seeIPv4Address.getIPv4MappedAddress()You should also overrideIPAddress.toIPv6()to match the conversion. This method returns true for all IPv6 addresses.- Specified by:
isIPv6Convertiblein classIPAddress- Returns:
-
toMappedIPv4Segments
public IPv4AddressSection toMappedIPv4Segments()
::ffff:x:x/96 indicates IPv6 address mapped to IPv4
-
get6To4IPv4Address
public IPv4Address get6To4IPv4Address()
Returns the second and third segments as anIPv4Address. This can be used for IPv4 or for IPv6 6to4 addresses convertible to IPv4.- Returns:
- the address
-
getEmbeddedIPv4Address
public IPv4Address getEmbeddedIPv4Address()
Returns the embeddedIPv4Addressin the lowest (least-significant) two segments. This is used by IPv4-mapped, IPv4-compatible, ISATAP addresses and 6over4 addresses- Returns:
- the embedded
IPv4Address
-
getEmbeddedIPv4Address
public IPv4Address getEmbeddedIPv4Address(int byteIndex)
Produces an IPv4 address from any sequence of 4 bytes in this IPv6 address.- Parameters:
byteIndex- the byte index to start- Returns:
- Throws:
java.lang.IndexOutOfBoundsException- if the index is less than zero or bigger than 7
-
isLocal
public boolean isLocal()
Description copied from class:IPAddressReturns true if the address is link local, site local, organization local, administered locally, or unspecified. This includes both unicast and multicast.
-
isLinkLocal
public boolean isLinkLocal()
Description copied from class:IPAddressReturns whether the address is link local, whether unicast or multicast.- Specified by:
isLinkLocalin classIPAddress- See Also:
InetAddress.isLinkLocalAddress()
-
isSiteLocal
public boolean isSiteLocal()
- See Also:
InetAddress.isSiteLocalAddress()
-
isUniqueLocal
public boolean isUniqueLocal()
-
isIPv4Mapped
public boolean isIPv4Mapped()
Whether the address is IPv4-mapped ::ffff:x:x/96 indicates IPv6 address mapped to IPv4
-
isIPv4Compatible
public boolean isIPv4Compatible()
Whether the address is IPv4-compatible- See Also:
Inet6Address.isIPv4CompatibleAddress()
-
is6To4
public boolean is6To4()
Whether the address is IPv6 to IPv4 relay- See Also:
get6To4IPv4Address()
-
is6Over4
public boolean is6Over4()
Whether the address is 6over4
-
isTeredo
public boolean isTeredo()
Whether the address is Teredo
-
isIsatap
public boolean isIsatap()
Whether the address is ISATAP
-
isIPv4Translatable
public boolean isIPv4Translatable()
- Returns:
- Whether the address is IPv4 translatable as in rfc 2765
-
isWellKnownIPv4Translatable
public boolean isWellKnownIPv4Translatable()
Whether the address has the well-known prefix for IPv4 translatable addresses as in rfc 6052 and 6144- Returns:
-
isMulticast
public boolean isMulticast()
Description copied from class:AddressWhether the MAC address or IP address or other form of address is multicast.- Specified by:
isMulticastin classAddress- See Also:
InetAddress.isMulticastAddress()
-
isLoopback
public boolean isLoopback()
- Specified by:
isLoopbackin classIPAddress- See Also:
InetAddress.isLoopbackAddress()
-
intersect
public IPv6Address intersect(IPAddress other) throws AddressConversionException
Description copied from class:IPAddressProduces the subnet whose addresses are found in both this and the given subnet argument, or null if no such addresses.This is also known as the conjunction of the two sets of addresses.
If the address is not the same version, the default conversion will be applied using
IPAddress.toIPv4()orIPAddress.toIPv6(), and it that fails,AddressConversionExceptionwill be thrown.- Specified by:
intersectin classIPAddress- Returns:
- the subnet containing the addresses found in both this and the given subnet
- Throws:
AddressConversionException- if the address argument could not be converted to the same address version as this
-
subtract
public IPv6Address[] subtract(IPAddress other) throws AddressConversionException
Description copied from class:IPAddressSubtract the given subnet from this subnet, returning an array of subnets for the result (the subnets will not be contiguous so an array is required).Computes the subnet difference, the set of addresses in this address subnet but not in the provided subnet. This is also known as the relative complement of the given argument in this subnet.
If the address is not the same version, the default conversion will be applied using
IPAddress.toIPv4()orIPAddress.toIPv6(), and it that fails,AddressConversionExceptionwill be thrown.- Specified by:
subtractin classIPAddress- Returns:
- the difference
- Throws:
AddressConversionException- if the address argument could not be converted to the same address version as this
-
adjustPrefixBySegment
public IPv6Address adjustPrefixBySegment(boolean nextSegment)
Description copied from interface:AddressSegmentSeriesIncreases or decreases prefix length to the next segment boundary.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. To avoid the zeroing behaviour, useAddressSegmentSeries.adjustPrefixBySegment(boolean, boolean)with second arg false.- Specified by:
adjustPrefixBySegmentin interfaceAddressSegmentSeries- Specified by:
adjustPrefixBySegmentin interfaceIPAddressSegmentSeries- Specified by:
adjustPrefixBySegmentin classIPAddress- Parameters:
nextSegment- whether to move prefix to previous or following segment boundary- Returns:
-
adjustPrefixBySegment
public IPv6Address adjustPrefixBySegment(boolean nextSegment, boolean zeroed)
Description copied from interface:AddressSegmentSeriesIncreases or decreases prefix length to the next segment boundary.- Specified by:
adjustPrefixBySegmentin interfaceAddressSegmentSeries- Specified by:
adjustPrefixBySegmentin interfaceIPAddressSegmentSeries- Specified by:
adjustPrefixBySegmentin classIPAddress- Parameters:
nextSegment- whether to move prefix to previous or following segment boundaryzeroed- whether the bits that move from one side of the prefix to the other become zero or retain their original values- Returns:
-
adjustPrefixLength
public IPv6Address adjustPrefixLength(int adjustment)
Description copied from class:IPAddressIncreases or decreases prefix length by the given increment.When 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, and if the entire host address contains the zero address, then the resulting address is determined
AddressNetwork.getPrefixConfiguration().For example, 1.2.0.0/16 adjusted by -8 becomes 1.0.0.0/8.
1.2.0.0/16 adjusted by 8 becomes 1.2.0.0/24- Specified by:
adjustPrefixLengthin interfaceAddressSegmentSeries- Specified by:
adjustPrefixLengthin interfaceIPAddressSegmentSeries- Specified by:
adjustPrefixLengthin classIPAddress- Returns:
-
adjustPrefixLength
public IPv6Address adjustPrefixLength(int adjustment, boolean zeroed)
Description copied from interface:AddressSegmentSeriesIncreases or decreases prefix length by the given increment.- Specified by:
adjustPrefixLengthin interfaceAddressSegmentSeries- Specified by:
adjustPrefixLengthin interfaceIPAddressSegmentSeries- Specified by:
adjustPrefixLengthin classIPAddress- Parameters:
adjustment- the incrementzeroed- whether the bits that move from one side of the prefix to the other become zero or retain their original values- Returns:
-
setPrefixLength
public IPv6Address setPrefixLength(int prefixLength) throws PrefixLenException
Description copied from interface:AddressSegmentSeriesSets the prefix length.If this series has a prefix length, and the prefix length is increased, the bits moved within the prefix become zero. For an alternative that does not set bits to zero, use
AddressSegmentSeries.setPrefixLength(int, boolean)with the second argument as false.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.
- Specified by:
setPrefixLengthin interfaceAddressSegmentSeries- Specified by:
setPrefixLengthin interfaceIPAddressSegmentSeries- Specified by:
setPrefixLengthin classIPAddress- Returns:
- Throws:
PrefixLenException
-
setPrefixLength
public IPv6Address setPrefixLength(int prefixLength, boolean zeroed) throws PrefixLenException
Description copied from interface:AddressSegmentSeriesSets the prefix length.When the prefix is extended beyond the segment series boundary, it is removed.
- Specified by:
setPrefixLengthin interfaceAddressSegmentSeries- Specified by:
setPrefixLengthin interfaceIPAddressSegmentSeries- Specified by:
setPrefixLengthin classIPAddresszeroed- 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.- Returns:
- Throws:
PrefixLenException
-
setPrefixLength
public IPv6Address setPrefixLength(int prefixLength, boolean zeroed, boolean zeroHostIsBlock) throws PrefixLenException
Description copied from class:IPAddressSets the prefix length while allowing the caller to control whether bits moved in or out of the prefix become zero, and whether a zero host for the new prefix bits can be translated into a prefix block. The latter behaviour only applies to the default prefix handling configuration, PREFIXED_ZERO_HOSTS_ARE_SUBNETS. The methodsIPAddress.setPrefixLength(int, boolean)andIPAddress.setPrefixLength(int)use a value of true for zeroed and for zeroHostIsBlock.For example, when zeroHostIsBlock is true, applying to 1.2.0.0 the prefix length 16 results in 1.2.*.*/16
Or if you start with 1.2.0.0/24, setting the prefix length to 16 results in a zero host followed by the existing prefix block, which is then converted to a full prefix block, 1.2.*.*/16
When both zeroed and zeroHostIsBlock are true, applying the prefiix length of 16 to 1.2.4.0/24 also results in a zero host followed by the existing prefix block, which is then converted to a full prefix block, 1.2.*.*/16.
When both zeroed and zeroHostIsBlock are false, the resulting address always encompasses the same set of addresses as the original, albeit with a different prefix length.
- Specified by:
setPrefixLengthin classIPAddress- Returns:
- Throws:
PrefixLenException
-
applyPrefixLength
@Deprecated public IPv6Address applyPrefixLength(int networkPrefixLength) throws PrefixLenException
Deprecated.Description copied from interface:AddressSegmentSeriesApplies the given prefix length to create a new segment series.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.
- Specified by:
applyPrefixLengthin interfaceAddressSegmentSeries- Specified by:
applyPrefixLengthin interfaceIPAddressSegmentSeries- Specified by:
applyPrefixLengthin classIPAddress- Returns:
- Throws:
PrefixLenException- See Also:
AddressSegmentSeries.setPrefixLength(int)
-
removePrefixLength
@Deprecated public IPv6Address removePrefixLength()
Deprecated.Description copied from interface:AddressSegmentSeriesRemoves the prefix length while zeroing out the bits beyond the prefix.If the series already has a prefix length, the bits outside the prefix become zero. Use
AddressSegmentSeries.withoutPrefixLength()to remove the prefix length without changing the series values.Equivalent to calling removePrefixLength(true)
- Specified by:
removePrefixLengthin interfaceAddressSegmentSeries- Specified by:
removePrefixLengthin interfaceIPAddressSegmentSeries- Specified by:
removePrefixLengthin classIPAddress- Returns:
- See Also:
for an alternative which does not change the address series values.
-
withoutPrefixLength
public IPv6Address withoutPrefixLength()
Description copied from interface:AddressSegmentSeriesProvides the same address with no prefix. The values remain unchanged.Use
AddressSegmentSeries.removePrefixLength()as an alternative that deletes the host at the same time by zeroing the host values.- Specified by:
withoutPrefixLengthin interfaceAddressSegmentSeries- Specified by:
withoutPrefixLengthin interfaceIPAddressSegmentSeries- Specified by:
withoutPrefixLengthin classIPAddress
-
removePrefixLength
@Deprecated public IPv6Address removePrefixLength(boolean zeroed)
Deprecated.Description copied from interface:AddressSegmentSeriesRemoves the prefix length. If zeroed is false, the bits that were host bits do not become zero, unlikeAddressSegmentSeries.removePrefixLength()- Specified by:
removePrefixLengthin interfaceAddressSegmentSeries- Specified by:
removePrefixLengthin interfaceIPAddressSegmentSeries- Specified by:
removePrefixLengthin classIPAddress- Parameters:
zeroed- whether the bits outside the prefix become zero- Returns:
-
toZeroHost
public IPv6Address toZeroHost()
Description copied from interface:IPAddressSegmentSeriesReturns the segment series with a host of zero, the host being the bits following the prefix length. If the series has no prefix length, then it returns an all-zero series.The default behaviour is that the resultant series will have the same prefix length. The resultant series will not have a prefix length if
AddressNetwork.getPrefixConfiguration()isAddressNetwork.PrefixConfiguration.ALL_PREFIXED_ADDRESSES_ARE_SUBNETS.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- Specified by:
toZeroHostin interfaceIPAddressSegmentSeries- Specified by:
toZeroHostin classIPAddress- Returns:
- See Also:
IPAddressSegmentSeries.toZeroNetwork()
-
toZeroHost
public IPv6Address toZeroHost(int prefixLength)
Description copied from interface:IPAddressSegmentSeriesProduces the series with host values of 0 for the given prefix length.If 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- Specified by:
toZeroHostin interfaceIPAddressSegmentSeries- Specified by:
toZeroHostin classIPAddress- Returns:
-
toZeroNetwork
public IPv6Address toZeroNetwork()
Description copied from interface:IPAddressSegmentSeriesReturns the segment series with a network of zero, the network being the bits within the prefix length. If the series has no prefix length, then it returns an all-zero series.The default behaviour is that the resultant series will have the same prefix length. The resultant series will not have a prefix length if
AddressNetwork.getPrefixConfiguration()isAddressNetwork.PrefixConfiguration.ALL_PREFIXED_ADDRESSES_ARE_SUBNETS.- Specified by:
toZeroNetworkin interfaceIPAddressSegmentSeries- Specified by:
toZeroNetworkin classIPAddress- Returns:
- See Also:
IPAddressSegmentSeries.toZeroHost()
-
toMaxHost
public IPv6Address toMaxHost()
Description copied from interface:IPAddressSegmentSeriesReturns the segment series with a host of all ones. If the series has no prefix length, then it returns an all-ones series.The resultant series will have the same prefix length if
AddressNetwork.getPrefixConfiguration()is notAddressNetwork.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- Specified by:
toMaxHostin interfaceIPAddressSegmentSeries- Specified by:
toMaxHostin classIPAddress- Returns:
-
toMaxHost
public IPv6Address toMaxHost(int prefixLength)
Description copied from interface:IPAddressSegmentSeriesProduces the series with host values of all one bits for the given prefix length.If 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- Specified by:
toMaxHostin interfaceIPAddressSegmentSeries- Specified by:
toMaxHostin classIPAddress- Returns:
-
mask
public IPv6Address mask(IPAddress mask, boolean retainPrefix) throws IncompatibleAddressException, AddressConversionException
Description copied from class:IPAddressApplies the given mask to all addresses represented by this IPAddress. The mask is applied to all individual addresses. Any existing prefix length is removed beforehand. If the retainPrefix argument is true, then the existing prefix length will be applied to the result.If the mask is a different version than this, then the default conversion is applied to the other address first using
IPAddress.toIPv4()orIPAddress.toIPv6()If this represents multiple addresses, and applying the mask to all addresses creates a set of addresses that cannot be represented as a contiguous range within each segment, then
IncompatibleAddressExceptionis thrown.- Specified by:
maskin classIPAddress- Returns:
- Throws:
IncompatibleAddressException- if this is a range of addresses and applying the mask results in an address that cannot be represented as a contiguous range within each segmentAddressConversionException- if the address argument could not be converted to the same address version as this
-
mask
public IPv6Address mask(IPAddress mask) throws IncompatibleAddressException, AddressConversionException
Description copied from class:IPAddressEquivalent to callingIPAddress.mask(IPAddress, boolean)with the second argument as false.If the mask is a different version than this, then the default conversion is applied to the other address first using
IPAddress.toIPv4()orIPAddress.toIPv6()- Specified by:
maskin classIPAddress- Returns:
- Throws:
IncompatibleAddressException- if this is a range of addresses and applying the mask results in an address that cannot be represented as a contiguous range within each segmentAddressConversionException- if the address argument could not be converted to the same address version as this
-
maskNetwork
public IPv6Address maskNetwork(IPAddress mask, int networkPrefixLength) throws IncompatibleAddressException, PrefixLenException, AddressConversionException
Description copied from class:IPAddressApplies the given mask to all addresses represented by this IPAddress while also applying the given prefix length at the same time.Any existing prefix length is removed as the mask and new prefix length is applied to all individual addresses.
If the mask is a different version than this, then the default conversion is applied to the other address first using
IPAddress.toIPv4()orIPAddress.toIPv6()If this represents multiple addresses, and applying the mask to all addresses creates a set of addresses that cannot be represented as a contiguous range within each segment, then
IncompatibleAddressExceptionis thrown.- Specified by:
maskNetworkin classIPAddress- Throws:
IncompatibleAddressException- if this is a range of addresses and applying the mask results in an address that cannot be represented as a contiguous range within each segmentAddressConversionException- if the address argument could not be converted to the same address version as thisPrefixLenException
-
bitwiseOr
public IPv6Address bitwiseOr(IPAddress mask, boolean retainPrefix) throws IncompatibleAddressException, AddressConversionException
Description copied from class:IPAddressDoes the bitwise disjunction with this address. Useful when subnetting.The mask is applied to all individual addresses, similar to how the method
IPAddress.mask(IPAddress, boolean)applies the bitwise conjunction. Any existing prefix length is removed beforehand. If the retainPrefix argument is true, then the existing prefix length will be applied to the result.If the mask is a different version than this, then the default conversion is applied to the other address first using
IPAddress.toIPv4()orIPAddress.toIPv6()If you wish to mask a section of the network, use
IPAddress.bitwiseOrNetwork(IPAddress, int)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 hostMask = address.getNetwork().getHostMask(address.getNetworkPrefixLength());//0.0.255.255 IPAddress broadcastAddress = address.bitwiseOr(hostMask); //1.2.255.255- Specified by:
bitwiseOrin classIPAddress- Returns:
- Throws:
IncompatibleAddressException- if this is a range of addresses and applying the mask results in an address that cannot be represented as a contiguous range within each segmentAddressConversionException- if the address argument could not be converted to the same address version as this
-
bitwiseOr
public IPv6Address bitwiseOr(IPAddress mask) throws IncompatibleAddressException, AddressConversionException
Description copied from class:IPAddressEquivalent to callingIPAddress.bitwiseOr(IPAddress, boolean)with the second argument as false.If the mask is a different version than this, then the default conversion is applied to the other address first using
IPAddress.toIPv4()orIPAddress.toIPv6()- Specified by:
bitwiseOrin classIPAddress- Returns:
- Throws:
IncompatibleAddressException- if this is a range of addresses and applying the mask results in an address that cannot be represented as a contiguous range within each segmentAddressConversionException- if the address argument could not be converted to the same address version as this
-
bitwiseOrNetwork
public IPv6Address bitwiseOrNetwork(IPAddress mask, int networkPrefixLength) throws IncompatibleAddressException, PrefixLenException, AddressConversionException
Description copied from class:IPAddressDoes the bitwise disjunction with this address. Useful when subnetting.If the mask is a different version than this, then the default conversion is applied to the other address first using
IPAddress.toIPv4()orIPAddress.toIPv6()Any existing prefix length is dropped for the new prefix length and the mask is applied up to the end the new prefix length. It is similar to how the
IPAddress.maskNetwork(IPAddress, int)method does the bitwise conjunction.- Specified by:
bitwiseOrNetworkin classIPAddressnetworkPrefixLength- the new prefix length for the address- Returns:
- Throws:
IncompatibleAddressException- if this is a range of addresses and applying the mask results in an address that cannot be represented as a contiguous range within each segmentAddressConversionException- if the address argument could not be converted to the same address version as thisPrefixLenException
-
getHostMask
public IPv6Address getHostMask()
Description copied from interface:IPAddressSegmentSeriesReturns the host mask associated with the CIDR network prefix length of this series. If this series has no prefix length, then the whole series is considered a host and the all ones host mask is returned.- Specified by:
getHostMaskin interfaceIPAddressSegmentSeries- Overrides:
getHostMaskin classIPAddress- Returns:
-
getNetworkMask
public IPv6Address getNetworkMask()
Description copied from interface:IPAddressSegmentSeriesReturns the network mask associated with the CIDR network prefix length of this series. If this series has no prefix length, then the whole series is considered network and the all ones network mask is returned.- Specified by:
getNetworkMaskin interfaceIPAddressSegmentSeries- Overrides:
getNetworkMaskin classIPAddress- Returns:
-
getNetworkSection
public IPv6AddressSection getNetworkSection()
Description copied from interface:IPAddressSegmentSeriesReturns 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.- Specified by:
getNetworkSectionin interfaceIPAddressSegmentSeries- Returns:
-
getNetworkSection
public IPv6AddressSection getNetworkSection(int networkPrefixLength) throws PrefixLenException
Description copied from interface:IPAddressSegmentSeriesReturns the network section of the series. The returned section will have only as many segments as needed as indicated by networkPrefixLength. It will have networkPrefixLength as its associated prefix length, unless this address already has a smaller prefix length, in which case the existing prefix length is retained.- Specified by:
getNetworkSectionin interfaceIPAddressSegmentSeries- Returns:
- Throws:
PrefixLenException
-
getNetworkSection
public IPv6AddressSection getNetworkSection(int networkPrefixLength, boolean withPrefixLength) throws PrefixLenException
Description copied from interface:IPAddressSegmentSeriesReturns the network section of the series. The returned section will have only as many segments as needed as indicated by networkPrefixLength. If withPrefixLength is true, it will have networkPrefixLength as its associated prefix length, unless this series already has a smaller prefix length, in which case the existing prefix length is retained.- Specified by:
getNetworkSectionin interfaceIPAddressSegmentSerieswithPrefixLength- whether the resulting section will have networkPrefixLength as the associated prefix length or not- Returns:
- Throws:
PrefixLenException
-
getHostSection
public IPv6AddressSection getHostSection(int networkPrefixLength) throws PrefixLenException
Description copied from interface:IPAddressSegmentSeriesReturns the host section of the address as indicated by the network prefix length provided. The returned section will have only as many segments as needed to hold the host as indicated by the provided network prefix length.- Specified by:
getHostSectionin interfaceIPAddressSegmentSeries- Returns:
- Throws:
PrefixLenException
-
getHostSection
public IPv6AddressSection getHostSection()
Description copied from interface:IPAddressSegmentSeriesReturns the host section of the series. The returned section will have only as many segments as needed as determined by the existing CIDR network prefix length. If this series has no CIDR prefix length, the returned host section will be the full section associated with a prefix length of 0.- Specified by:
getHostSectionin interfaceIPAddressSegmentSeries- Returns:
-
toPrefixBlock
public IPv6Address toPrefixBlock()
Description copied from class:IPAddressReturns the subnet associated with the prefix length of this address. If this address has no prefix length, this address is returned.For example, if the address is 1.2.3.4/16 it returns the subnet 1.2.*.* /16
- Specified by:
toPrefixBlockin interfaceAddressSegmentSeries- Specified by:
toPrefixBlockin interfaceIPAddressSegmentSeries- Specified by:
toPrefixBlockin classIPAddress- Returns:
- the block of address series for the prefix length
-
toPrefixBlock
public IPv6Address toPrefixBlock(int networkPrefixLength) throws PrefixLenException
Description copied from interface:IPAddressSegmentSeriesReturns the segment series of the same length that spans all hosts. The network prefix length will be the one provided, and the network values will match the same of this series.- Specified by:
toPrefixBlockin interfaceIPAddressSegmentSeries- Specified by:
toPrefixBlockin classIPAddress- Returns:
- Throws:
PrefixLenException
-
assignPrefixForSingleBlock
public IPv6Address assignPrefixForSingleBlock()
Description copied from class:IPAddressReturns the equivalent CIDR address with a prefix length for which the address subnet block matches the range of values in this address.If no such prefix length exists, returns null.
Examples:
1.2.3.4 returns 1.2.3.4/32
1.2.*.* returns 1.2.0.0/16
1.2.*.0/24 returns 1.2.0.0/16
1.2.*.4 returns null
1.2.252-255.* returns 1.2.252.0/22
1.2.3.4/x returns the same address- Specified by:
assignPrefixForSingleBlockin interfaceIPAddressSegmentSeries- Overrides:
assignPrefixForSingleBlockin classIPAddress- Returns:
- See Also:
IPAddressSegmentSeries.toPrefixBlock(),IPAddressSegmentSeries.assignMinPrefixForBlock()
-
assignMinPrefixForBlock
public IPv6Address assignMinPrefixForBlock()
Description copied from class:IPAddressConstructs an equivalent address with the smallest CIDR prefix possible (largest network), such that the range of values are a set of subnet blocks for that prefix.- Specified by:
assignMinPrefixForBlockin interfaceIPAddressSegmentSeries- Overrides:
assignMinPrefixForBlockin classIPAddress- Returns:
- See Also:
IPAddressSegmentSeries.toPrefixBlock(),IPAddressSegmentSeries.assignPrefixForSingleBlock()
-
coverWithPrefixBlock
public IPv6Address coverWithPrefixBlock()
Description copied from interface:IPAddressSegmentSeriesReturns the minimal-size prefix block that covers all the values in this series. The resulting block will have a larger series count than this, unless this series is already a prefix block.- Specified by:
coverWithPrefixBlockin interfaceIPAddressRange- Specified by:
coverWithPrefixBlockin interfaceIPAddressSegmentSeries
-
coverWithPrefixBlock
public IPv6Address coverWithPrefixBlock(IPAddress other) throws AddressConversionException
Description copied from class:IPAddressReturns the minimal-size prefix block that covers all the addresses spanning from this subnet to the given subnet.If the other address is a different version than this, then the default conversion is applied to the other address first using
IPAddress.toIPv4()orIPAddress.toIPv6()When you have multiple subnets, cover with:
IPAddress block = subnet0.applyToBounds(IPAddress::coverWithPrefixBlock, subnet1, subnet2, ...);See
IPAddress.applyToBounds(java.util.function.BiFunction, IPAddress...)- Specified by:
coverWithPrefixBlockin classIPAddress- Throws:
AddressConversionException
-
spanWithPrefixBlocks
public IPv6Address[] spanWithPrefixBlocks()
Produces an array of prefix blocks that cover the same set of addresses as this.Unlike
spanWithPrefixBlocks(IPAddress)this method only includes addresses that are a part of this subnet.- Specified by:
spanWithPrefixBlocksin interfaceIPAddressRange- Specified by:
spanWithPrefixBlocksin interfaceIPAddressSegmentSeries
-
spanWithPrefixBlocks
public IPv6Address[] spanWithPrefixBlocks(IPAddress other) throws AddressConversionException
Description copied from class:IPAddressProduces the list of prefix block subnets that span from this subnet to the given subnet.If the other address is a different version than this, then the default conversion is applied to the other address first using
IPAddress.toIPv4()orIPAddress.toIPv6()The resulting array is sorted from lowest address value to highest, regardless of the size of each prefix block.
From the list of returned subnets you can recover the original range (this to other) by converting each to IPAddressRange with
IPAddress.toSequentialRange()and them joining them into a single range withIPAddressSeqRange.join(IPAddressSeqRange...)When you have multiple subnets, span with:
IPAddress blocks[] = subnet0.applyToBounds(IPAddress::spanWithPrefixBlocks, subnet1, subnet2, ...);See
IPAddress.applyToBounds(java.util.function.BiFunction, IPAddress...)- Specified by:
spanWithPrefixBlocksin classIPAddress- Returns:
- Throws:
AddressConversionException
-
spanWithSequentialBlocks
public IPv6Address[] spanWithSequentialBlocks() throws AddressConversionException
Produces an array of blocks that are sequential that cover the same set of addresses as this.This array can be shorter than that produced by
spanWithPrefixBlocks()and is never longer.Unlike
spanWithSequentialBlocks(IPAddress)this method only includes addresses that are a part of this subnet.- Specified by:
spanWithSequentialBlocksin interfaceIPAddressRange- Specified by:
spanWithSequentialBlocksin interfaceIPAddressSegmentSeries- Throws:
AddressConversionException
-
spanWithSequentialBlocks
public IPv6Address[] spanWithSequentialBlocks(IPAddress other) throws AddressConversionException
Description copied from class:IPAddressProduces a list of sequential block subnets that span all values from this subnet to the given subnet. The span will cover the sequence of all addresses from the lowest address in both subnets to the highest address in both subnets.Individual block subnets come in the form 1-3.1-4.5.6-8, however that particular subnet is not sequential since address 1.1.5.8 is in the subnet, the next sequential address 1.1.5.9 is not in the subnet, and a higher address 1.2.5.6 is in the subnet. Blocks are sequential when the first segment with a range of values is followed by segments that span all values.
If the other address is a different version than this, then the default conversion is applied to the other address first using
IPAddress.toIPv4()orIPAddress.toIPv6()The resulting array is sorted from lowest address value to highest, regardless of the size of each prefix block.
From the list of returned subnets you can recover the original range (this and other) by converting each to IPAddressRange with
IPAddress.toSequentialRange()and them joining them into a single range withIPAddressSeqRange.join(IPAddressSeqRange...)When you have multiple subnets, span with:
IPAddress blocks[] = subnet0.applyToBounds(IPAddress::spanWithSequentialBlocks, subnet1, subnet2, ...);See
IPAddress.applyToBounds(java.util.function.BiFunction, IPAddress...)- Specified by:
spanWithSequentialBlocksin classIPAddress- Returns:
- Throws:
AddressConversionException
-
spanWithRange
public IPv6AddressSeqRange spanWithRange(IPAddress other) throws AddressConversionException
Description copied from class:IPAddressProduces an IPAddressRange instance that spans this subnet to the given subnet.If the other address is a different version than this, then the default conversion is applied to the other address first using
IPAddress.toIPv4()orIPAddress.toIPv6()When you have multiple subnets, span with:
IPAddressSeqRange range = subnet0.applyToBounds(IPAddress::spanWithRange, subnet1, subnet2, ...);See
IPAddress.applyToBounds(java.util.function.BiFunction, IPAddress...)- Specified by:
spanWithRangein classIPAddress- Returns:
- Throws:
AddressConversionException
-
mergeToPrefixBlocks
public IPv6Address[] mergeToPrefixBlocks(IPAddress... addresses) throws AddressConversionException
Description copied from class:IPAddressMerges this with the list of addresses to produce the smallest list of prefix blocks.For the smallest list of subnets use
IPAddress.mergeToSequentialBlocks(IPAddress...).If any other address in the list is a different version than this, then the default conversion is applied to the other address first using
IPAddress.toIPv4()orIPAddress.toIPv6(), which can result in AddressConversionExceptionThe resulting array is sorted from lowest address value to highest, regardless of the size of each prefix block.
In version 5.3.1 and earlier, the result was sorted from single address to smallest blocks to largest blocks. For that ordering, sort with
IPAddressSegmentSeries.getPrefixLenComparator():
Arrays.sort(result, IPAddressSegmentSeries.getPrefixLenComparator());The merging process works with sequential blocks. CIDR prefix subnets have just a single sequential block, as does individual addresses. So this method works efficiently for most conventionally-used subnets.
For example, the subnet ::*:*:*:1-ffff has 281474976710656 sequential blocks. Just like you should avoid iterating through such a large number of blocks, you should avoid using this method to merge such a subnet, rather than a subnet like ::1-ffff:*:*:*:* which has 1 sequential block, or the subnet ::1-ffff:1-ffff:*:*:*:* which has 65535 sequential blocks. You can use
IPAddress.getSequentialBlockCount()to get the sequential block count.There are alternatives ways to merge into prefix blocks available in this library. Typically this method is most efficient when merging CIDR prefix blocks and/or individual addresses, which is likely to be the case for most users most of the time. It converts to CIDR prefix blocks prior to merging, if not CIDR prefix blocks or individual addresses already.
When merging a large number of blocks that are not prefix blocks nor individual addresses, it may be more efficient to merge first and then convert to CIDR prefix blocks afterwards. You can use
IPAddress.mergeToSequentialBlocks(IPAddress...)to merge, and then span each merged element in the result withIPAddressSegmentSeries.spanWithPrefixBlocks(), giving the same result as this method.Sequential ranges provide another option. You can convert to sequential blocks first with
IPAddress.sequentialBlockIterator(), then convert each sequential block toIPAddressSeqRangewithIPAddress.toSequentialRange(), then join those sequential ranges withIPAddressSeqRange.join(IPAddressSeqRange...), then convert them to CIDR prefix blocks withIPAddressSeqRange.spanWithPrefixBlocks(), giving the same result as this method.- Specified by:
mergeToPrefixBlocksin classIPAddress- Parameters:
addresses- the addresses to merge with this- Returns:
- Throws:
AddressConversionException
-
mergeToSequentialBlocks
public IPv6Address[] mergeToSequentialBlocks(IPAddress... addresses) throws AddressConversionException
Description copied from class:IPAddressMerges this with the list of subnets to produce the smallest list of block subnets that are sequential.Block subnets come in the form 1-3.1-4.5.6-8, however that subnet is not sequential since address 1.1.5.8 is in the subnet, the next sequential address 1.1.5.9 is not in the subnet, and a higher address 1.2.5.6 is in the subnet. Blocks are sequential when the first segment with a range of values is followed by segments that span all values.
This list will eliminate overlaps to produce the smallest list of sequential block subnets, which is the same size or smaller than the list of prefix blocks produced by
IPAddress.mergeToPrefixBlocks(IPAddress...)If the incoming blocks are not sequential, the result could be a longer list, since the list is divided into sequential blocks before merging.
If any other address in the list is a different version than this, then the default conversion is applied to the other address first using
IPAddress.toIPv4()orIPAddress.toIPv6(), which can result in AddressConversionExceptionThe resulting array is sorted by lower address, regardless of the size of each prefix block.
In version 5.3.1 and earlier, the result was sorted from single address to smallest blocks to largest blocks. For that ordering, sort with
IPAddressSegmentSeries.getPrefixLenComparator():
Arrays.sort(result, IPAddressSegmentSeries.getPrefixLenComparator());See the javadoc for
IPAddress.mergeToPrefixBlocks(IPAddress...)for some alternatives for merging subnets.- Specified by:
mergeToSequentialBlocksin classIPAddress- Parameters:
addresses- the addresses to merge with this- Returns:
- Throws:
AddressConversionException
-
hasZone
public boolean hasZone()
Returns whethergetZone()returns a non-null value- Returns:
-
getZone
public java.lang.String getZone()
The zone or scope id string, which as a string is typically appended to an address with a '%', eg fe80::71a3:2b00:ddd3:753f%16 If there is no zone or scope id, returns null.See
getIPv6Zone()- Returns:
-
setZone
public IPv6Address setZone(IPv6Address.IPv6Zone newZone)
Returns a new address with the same address values but with the supplied zone. If the supplied zone is null, equivalent to callingremoveZone()- Parameters:
newZone-- Returns:
-
getIPv6Zone
public IPv6Address.IPv6Zone getIPv6Zone()
Returns the zone or scope id, consisting of a network interface name or a positive integer scope identifier. If there is no zone or scope id, returns nullAn IPv6 zone distinguishes two IPv6 addresses that are the same. They are used with link-local addresses fe80::/10 and distinguishes two interfaces to the link-local network, this is known as the zone id. They are used with site-local addresses to distinguish sites, using the site id, also known as the scope id. A zone that consists of a scope id is called a scoped zone. See
getZone()- Returns:
-
removeZone
public IPv6Address removeZone()
Returns the equivalent address but with no zone.- Returns:
-
toInetAddress
public java.net.Inet6Address toInetAddress()
Converts the lowest value of this address and the associated zone to an Inet6Address.Address with a zone should check for null.
This will return null if this IPv6 Address has a zone (available from
getIPv6Zone()), that zone references a network interface (IPv6Address.IPv6Zone.referencesInterfaceis true) and that network interface (fromIPv6Address.IPv6Zone.getAssociatedIntf()) is an IPv4-only interface, or that interface is not entirely link-local and this address is link-local, or that interface is not entirely site-local and this address is site-local.This will return null if this IPv6 Address has a zone (available from
getIPv6Zone()) and:- the zone is a scoped id and the address is a global IPv6 address.
- the zone specifies an interface that does not exist on this host.
- the zone specifies an interface that is IPv4 only.
- the zone specifies an interface that is not entirely link-local and this address is link-local.
- the zone specifies an interface that is not entirely site-local and this address is site-local.
Inet6Address.getByAddress(String, byte[], NetworkInterface)will throw UnknownHostException when constructed with the same network interface.If this address is IPv4-mapped, then any associated zone will be discarded, because it is not possible to create an IPv4-mapped Inet6Address with a zone.
- Overrides:
toInetAddressin classIPAddress
-
toUpperInetAddress
public java.net.Inet6Address toUpperInetAddress()
Description copied from class:IPAddressConverts the highest value of this address to an InetAddress. If this consists of just a single address and not a subnet, this is equivalent toIPAddress.toInetAddress()- Overrides:
toUpperInetAddressin classIPAddress
-
toSequentialRange
@Deprecated public IPv6AddressSeqRange toSequentialRange(IPAddress other)
Deprecated.Description copied from class:IPAddressCreates a sequential range instance from this and the given address, spanning from the lowest to the highest addresses in the two subnetsIf the other address is a different version than this, then the default conversion is applied to the other address first using
IPAddress.toIPv4()orIPAddress.toIPv6()When you have multiple subnets, create a range from lowest to highest with:
IPAddressSeqRange range = subnet0.applyToBounds(IPAddress::toSequentialRange, subnet1, subnet2, ...);See
IPAddress.applyToBounds(java.util.function.BiFunction, IPAddress...)- Specified by:
toSequentialRangein classIPAddress- Returns:
-
toSequentialRange
public IPv6AddressSeqRange toSequentialRange()
Description copied from class:IPAddressCreates a sequential range instance from the lowest and highest addresses in this subnetThe two will represent the same set of individual addresses if and only if
Address.isSequential()is true. To get a series of ranges that represent the same set of individual addresses use theIPAddress.sequentialBlockIterator()(orIPAddress.prefixIterator()), and apply this method to each iterated subnet.If this represents just a single address then the returned instance covers just that single address as well.
- Specified by:
toSequentialRangein interfaceIPAddressRange- Specified by:
toSequentialRangein classIPAddress
-
isSameAddress
public boolean isSameAddress(Address other)
- Overrides:
isSameAddressin classAddress
-
overlaps
public boolean overlaps(Address other)
Description copied from class:AddressReturns whether this is same type and version of the given address and whether it overlaps with the individual addresses in the given address or subnet, containing at least one individual address common to both.
-
contains
public boolean contains(Address other)
Description copied from class:AddressReturns whether this is same type and version of the given address and whether it contains all individual addresses in the given address or subnet
-
enumerate
public java.math.BigInteger enumerate(Address other)
Description copied from class:AddressIndicates where an address sits relative to the subnet ordering.Determines how many address elements of a subnet precede the given address element, if the address is in the subnet. If above the subnet range, it is the distance to the upper boundary added to the subnet address count less one, and if below the subnet range, the distance to the lower boundary.
In other words, if the given address is not in the subnet but above it, returns the number of addresses preceding the address from the upper subnet boundary, added to one less than the total number of subnet addresses. If the given address is not in the subnet but below it, returns the number of addresses following the address to the lower subnet boundary.
enumerate returns null when the argument is a multi-valued subnet. The argument must be an individual address.
When this address is also single-valued, the returned value is the distance (difference) between this address and the argument address.
enumerate is the inverse of the increment method:
- subnet.enumerate(subnet.increment(inc)) = inc
- subnet.increment(subnet.enumerate(newAddr)) = newAddr
If the given address does not have the same version or type as this subnet or address, then null is returned.
-
enumerate
public java.math.BigInteger enumerate(IPAddress other)
Description copied from class:IPAddressIndicates where an address sits relative to the subnet ordering.For more details, see the equivalent method
Address.enumerate(Address). This method satisfies the implementation ofIPAddressRange.- Specified by:
enumeratein interfaceIPAddressRange- Specified by:
enumeratein classIPAddress- Returns:
-
toMixedString
public java.lang.String toMixedString()
Produces a string in which the lower 4 bytes are expressed as an IPv4 address and the remaining upper bytes are expressed in IPv6 format. This the mixed IPv6/IPv4 format described in RFC 1884 https://tools.ietf.org/html/rfc1884- Returns:
-
toCanonicalString
public java.lang.String toCanonicalString()
This produces a canonical string. RFC 5952 describes canonical representations. http://en.wikipedia.org/wiki/IPv6_address#Recommended_representation_as_text http://tools.ietf.org/html/rfc5952 If this has a prefix length, that will be included in the string.- Specified by:
toCanonicalStringin interfaceAddressSegmentSeries- Specified by:
toCanonicalStringin interfaceIPAddressRange- Overrides:
toCanonicalStringin classAddress- Returns:
-
toFullString
public java.lang.String toFullString()
Description copied from class:IPAddressThis produces a string with no compressed segments and all segments of full length, which is 4 characters for IPv6 segments and 3 characters for IPv4 segments. Each address has a unique full string, not counting CIDR the prefix, which can give two equal addresses different strings.- Specified by:
toFullStringin interfaceIPAddressSegmentSeries- Overrides:
toFullStringin classIPAddress
-
toNormalizedString
public static java.lang.String toNormalizedString(IPv6AddressNetwork network, Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, java.lang.Integer prefixLength, java.lang.CharSequence zone)
Creates the normalized string for an address without having to create the address objects first.- Parameters:
lowerValueProvider-upperValueProvider-prefixLength-zone-network- useAddress.defaultIpv6Network()if there is no custom network in use- Returns:
-
toNormalizedString
public java.lang.String toNormalizedString()
The normalized string returned by this method is consistent with java.net.Inet6address. IPs are not compressed nor mixed in this representation. If this has a prefix length, that will be included in the string.- Specified by:
toNormalizedStringin interfaceAddressComponent- Specified by:
toNormalizedStringin interfaceIPAddressRange- Overrides:
toNormalizedStringin classAddress- Returns:
-
toCompressedString
public java.lang.String toCompressedString()
This compresses the maximum number of zeros and/or host segments with the IPv6 compression notation '::'- Specified by:
toCompressedStringin interfaceAddressSegmentSeries- Overrides:
toCompressedStringin classAddress- Returns:
-
toSubnetString
public java.lang.String toSubnetString()
Description copied from class:IPAddressProduces a consistent subnet string that looks like 1.2.*.* or 1:2::/16 In the case of IPv4, this means that wildcards are used instead of a network prefix when a network prefix has been supplied. In the case of IPv6, when a network prefix has been supplied, the prefix will be shown and the host section will be compressed with ::.- Specified by:
toSubnetStringin interfaceIPAddressSegmentSeries- Overrides:
toSubnetStringin classIPAddress
-
toNormalizedWildcardString
public java.lang.String toNormalizedWildcardString()
Description copied from class:IPAddressThis produces a string similar to the normalized string but avoids the CIDR prefix. CIDR addresses will be shown with wildcards and ranges instead of using the CIDR prefix notation.- Specified by:
toNormalizedWildcardStringin interfaceIPAddressSegmentSeries- Overrides:
toNormalizedWildcardStringin classIPAddress
-
toBase85String
public java.lang.String toBase85String() throws IncompatibleAddressExceptionThe base 85 string is described by RFC 1924- Returns:
- Throws:
IncompatibleAddressException
-
toCanonicalWildcardString
public java.lang.String toCanonicalWildcardString()
Description copied from class:IPAddressThis produces a string similar to the canonical string but avoids the CIDR prefix. Addresses with a network prefix length will be shown with wildcards and ranges instead of using the CIDR prefix length notation. IPv6 addresses will be compressed according to the canonical representation.- Specified by:
toCanonicalWildcardStringin interfaceIPAddressSegmentSeries- Overrides:
toCanonicalWildcardStringin classIPAddress
-
toCompressedWildcardString
public java.lang.String toCompressedWildcardString()
Description copied from class:IPAddressThis is similar to toNormalizedWildcardString, avoiding the CIDR prefix, but with compression as well.- Specified by:
toCompressedWildcardStringin interfaceIPAddressSegmentSeries- Overrides:
toCompressedWildcardStringin classIPAddress
-
toSQLWildcardString
public java.lang.String toSQLWildcardString()
Description copied from class:IPAddressThis is the same as the string from toNormalizedWildcardString except that it usesAddress.SEGMENT_SQL_WILDCARDinstead ofAddress.SEGMENT_WILDCARDand also usesAddress.SEGMENT_SQL_SINGLE_WILDCARD- Specified by:
toSQLWildcardStringin interfaceIPAddressSegmentSeries- Overrides:
toSQLWildcardStringin classIPAddress
-
toHexString
public java.lang.String toHexString(boolean with0xPrefix) throws IncompatibleAddressExceptionDescription copied from class:AddressWrites this address as a single hexadecimal value with always the exact same number of characters, with or without a preceding 0x prefix. If this section represents a range of values outside of the network prefix length, then this is printed as a range of two hex values.- Specified by:
toHexStringin interfaceAddressComponent- Overrides:
toHexStringin classAddress- Throws:
IncompatibleAddressException
-
toBinaryString
public java.lang.String toBinaryString() throws IncompatibleAddressExceptionDescription copied from class:IPAddressWrites this address as a single binary value with always the exact same number of charactersIf this section represents a range of values not corresponding to a prefix, then this is printed as a range of two hex values.
- Specified by:
toBinaryStringin interfaceIPAddressSegmentSeries- Overrides:
toBinaryStringin classIPAddress- Throws:
IncompatibleAddressException
-
toSegmentedBinaryString
public java.lang.String toSegmentedBinaryString()
Description copied from interface:IPAddressSegmentSeriesWrites this IP address segment series as a segments of binary values preceded by the "0b" prefix.- Specified by:
toSegmentedBinaryStringin interfaceIPAddressSegmentSeries
-
toOctalString
public java.lang.String toOctalString(boolean with0Prefix) throws IncompatibleAddressExceptionDescription copied from class:IPAddressWrites this address as a single octal value with always the exact same number of characters, with or without a preceding 0 prefix.If this section represents a range of values not corresponding to a prefix, then this is printed as a range of two hex values.
- Specified by:
toOctalStringin interfaceIPAddressSegmentSeries- Overrides:
toOctalStringin classIPAddress- Throws:
IncompatibleAddressException
-
toPrefixLengthString
public java.lang.String toPrefixLengthString()
Description copied from class:IPAddressReturns a string with a CIDR network prefix length if this address has a network prefix length. For IPv6, the host section will be compressed with ::, for IPv4 the host section will be zeros.- Specified by:
toPrefixLengthStringin interfaceIPAddressSegmentSeries- Overrides:
toPrefixLengthStringin classIPAddress- Returns:
-
toConvertedString
public java.lang.String toConvertedString()
Description copied from class:IPAddressReturns a mixed string if it represents a convertible IPv4 address, returns the normalized string otherwise.- Overrides:
toConvertedStringin classIPAddress- Returns:
-
toNormalizedString
public java.lang.String toNormalizedString(IPAddressSection.IPStringOptions params)
Description copied from class:IPAddressConstructs a string representing this address according to the given parameters- Specified by:
toNormalizedStringin interfaceIPAddressSegmentSeries- Overrides:
toNormalizedStringin classIPAddress- Parameters:
params- the parameters for the address string- Returns:
-
toNormalizedString
public java.lang.String toNormalizedString(IPv6AddressSection.IPv6StringOptions params)
-
toNormalizedString
public java.lang.String toNormalizedString(boolean keepMixed, IPv6AddressSection.IPv6StringOptions params)Constructs a string representing this address according to the given parameters- Parameters:
keepMixed- if this address was constructed from a string with mixed representation (a:b:c:d:e:f:1.2.3.4), whether to keep it that way (ignored if makeMixed is true in the params argument)params- the parameters for the address string
-
toUNCHostName
public java.lang.String toUNCHostName()
Description copied from class:IPAddressGenerates the Microsoft UNC path component for this address- Specified by:
toUNCHostNamein classIPAddress- Returns:
-
toStandardStringCollection
public IPAddressPartStringCollection toStandardStringCollection()
- Overrides:
toStandardStringCollectionin classIPAddress
-
toAllStringCollection
public IPAddressPartStringCollection toAllStringCollection()
- Overrides:
toAllStringCollectionin classIPAddress
-
toStringCollection
public IPAddressPartStringCollection toStringCollection(IPAddressSection.IPStringBuilderOptions opts)
- Specified by:
toStringCollectionin interfaceIPAddressSegmentSeries- Overrides:
toStringCollectionin classIPAddress
-
toStringCollection
public IPAddressPartStringCollection toStringCollection(IPv6AddressSection.IPv6StringBuilderOptions opts)
-
-