inet.ipaddr

Interface AddressSegmentSeries

    • Method Detail

      • getNetwork

        AddressNetwork<?> getNetwork()
        Returns the network object for series of the same version (eg IPv4, IPv6 and MAC each have their own network object)
        Returns:
      • getSegmentCount

        int getSegmentCount()
        Returns the number of segments in this series.
        Returns:
      • getBitsPerSegment

        int getBitsPerSegment()
        Returns the number of bits comprising each segment in this series. Segments in the same series are equal length.
        Returns:
      • getBytesPerSegment

        int getBytesPerSegment()
        Returns the number of bytes comprising each segment in this series. Segments in the same series are equal length.
        Returns:
      • getSection

        AddressSection getSection(int index)
        Gets the subsection from the series starting from the given index
        Parameters:
        index -
        Returns:
        Throws:
        java.lang.IndexOutOfBoundsException - if index is negative
      • getSection

        AddressSection getSection(int index,
                                  int endIndex)
        Gets the subsection from the series starting from the given index and ending just before the give endIndex
        Parameters:
        index -
        endIndex -
        Returns:
        Throws:
        java.lang.IndexOutOfBoundsException - if index is negative or endIndex extends beyond the end of the series
      • getSegment

        AddressSegment getSegment(int index)
        Returns the segment from this series at the given index.
        Returns:
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is negative or as large as the segment count
      • getSegmentStrings

        java.lang.String[] getSegmentStrings()
        Returns the an array with the values of each segment as they would appear in the normalized with wildcards string.
        Returns:
      • getSegments

        void getSegments(AddressSegment[] segs)
        Copies the existing segments into the given array. The array size should be at least as large as getSegmentCount()
        Throws:
        java.lang.IndexOutOfBoundsException - if the provided array is too small
      • getSegments

        void getSegments(int start,
                         int end,
                         AddressSegment[] segs,
                         int index)
        get the segments from start to end and insert into the segs array at the the given index
        Parameters:
        start - the first segment index from this series to be included
        end - the segment index after first to be excluded
        segs - the target array
        index - where to insert the segments in the segs array
      • getLower

        AddressSegmentSeries getLower()
        If 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:
        getLower in interface AddressComponent
        Returns:
      • getUpper

        AddressSegmentSeries getUpper()
        If this represents a series with ranging values, returns a series representing the upper values of the range If this represents a series with a single value in each segment, returns this.
        Specified by:
        getUpper in interface AddressComponent
        Returns:
      • iterator

        java.util.Iterator<? extends AddressSegmentSeries> iterator()
        Iterates through the individual segment series. The resulting elements will not have an assigned prefix.
        Specified by:
        iterator in interface AddressComponent
        Returns:
      • segmentsIterator

        java.util.Iterator<? extends AddressSegment[]> segmentsIterator()
        Iterates through the individual segments.
      • toCanonicalString

        java.lang.String toCanonicalString()
        Produces the canonical representation of the address
        Returns:
      • toCompressedString

        java.lang.String toCompressedString()
        Produces a short representation of the address while remaining within the confines of standard representation(s) of the address
        Returns:
      • reverseBits

        AddressSegmentSeries reverseBits(boolean perByte)
        Returns a new segment series with the bits reversed.
        Specified by:
        reverseBits in interface AddressComponent
        Parameters:
        perByte - if true, only the bits in each byte are reversed, if false, then all bits in the component are reversed
        Returns:
        Throws:
        IncompatibleAddressException - if reversing the bits within a single segment cannot be done because the segment represents a range, and when all values in that range are reversed, the result is not contiguous. In practice this means that to be reversible the range must include all values except possibly the largest and/or smallest.
      • reverseBytes

        AddressSegmentSeries reverseBytes()
        Returns a new segment series with the bytes reversed.
        Specified by:
        reverseBytes in interface AddressComponent
        Returns:
        Throws:
        IncompatibleAddressException - if the segments have more than 1 bytes, and if reversing the bits within a single segment cannot be done because the segment represents a range that is not the entire segment range.
      • reverseBytesPerSegment

        AddressSegmentSeries reverseBytesPerSegment()
        Returns a new segment series with the bytes reversed within each segment.
        Returns:
        Throws:
        IncompatibleAddressException - if the segments have more than 1 bytes, and if reversing the bits within a single segment cannot be done because the segment represents a range that is not the entire segment range.
      • toPrefixBlock

        AddressSegmentSeries toPrefixBlock()
        If this series has a prefix length, returns the block for that prefix. Otherwise, this address series is returned.
        Returns:
        the block of address series for the prefix length
      • removePrefixLength

        AddressSegmentSeries removePrefixLength()
        Removes the prefix length.

        If the series already has a prefix length, the bits previously not within the prefix become zero.

        Returns:
      • adjustPrefixBySegment

        AddressSegmentSeries adjustPrefixBySegment(boolean nextSegment)
        Increases or decreases prefix length to the next segment boundary.

        When prefix length is increased, the bits moved within the prefix become zero. When a prefix length is decreased, whether the bits moved outside the prefix become zero is dependent on the address type.

        Parameters:
        nextSegment -
        Returns:
      • adjustPrefixLength

        AddressSegmentSeries adjustPrefixLength(int adjustment)
        Increases 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, whether the bits moved outside the prefix become zero is dependent on the address type.

        Parameters:
        adjustment -
        Returns:
      • setPrefixLength

        AddressSegmentSeries setPrefixLength(int prefixLength)
        Sets the prefix length.

        If this series has a prefix length, and the prefix length is increased, the bits moved within the prefix become zero.

        When the prefix is extended beyond the segment series boundary, it is removed.

        When a prefix length is decreased, whether the bits moved outside the prefix become zero is dependent on the address type.

        Parameters:
        prefixLength -
        Returns:
        See Also:
        applyPrefixLength(int)
      • applyPrefixLength

        AddressSegmentSeries applyPrefixLength(int prefixLength)
        Applies the given prefix length to create a new segment series.

        Similar to 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.

        With some address types, the bits moved outside the prefix will become zero in the returned series.

        Parameters:
        prefixLength -
        Returns:
        See Also:
        setPrefixLength(int)