public class MACAddress extends Address implements java.lang.Iterable<MACAddress>
Address.SegmentValueProvider| Modifier and Type | Field and Description |
|---|---|
static int |
BITS_PER_SEGMENT |
static int |
BYTES_PER_SEGMENT |
static char |
COLON_SEGMENT_SEPARATOR |
static char |
DASH_SEGMENT_SEPARATOR |
static char |
DASHED_SEGMENT_RANGE_SEPARATOR |
static java.lang.String |
DASHED_SEGMENT_RANGE_SEPARATOR_STR |
static int |
DEFAULT_TEXTUAL_RADIX |
static char |
DOTTED_SEGMENT_SEPARATOR |
static int |
EXTENDED_UNIQUE_IDENTIFIER_48_SEGMENT_COUNT |
static int |
EXTENDED_UNIQUE_IDENTIFIER_64_SEGMENT_COUNT |
static int |
MAX_VALUE_PER_DOTTED_SEGMENT |
static int |
MAX_VALUE_PER_SEGMENT |
static int |
MEDIA_ACCESS_CONTROL_DOTTED_64_SEGMENT_COUNT |
static int |
MEDIA_ACCESS_CONTROL_DOTTED_BITS_PER_SEGMENT |
static int |
MEDIA_ACCESS_CONTROL_DOTTED_SEGMENT_COUNT |
static int |
MEDIA_ACCESS_CONTROL_SEGMENT_COUNT |
static int |
MEDIA_ACCESS_CONTROL_SINGLE_DASHED_SEGMENT_COUNT |
static int |
ORGANIZATIONAL_UNIQUE_IDENTIFIER_BIT_COUNT |
static int |
ORGANIZATIONAL_UNIQUE_IDENTIFIER_SEGMENT_COUNT |
static char |
SPACE_SEGMENT_SEPARATOR |
addressComparator, ALTERNATIVE_RANGE_SEPARATOR, ALTERNATIVE_RANGE_SEPARATOR_STR, ALTERNATIVE_SEGMENT_WILDCARD_STR, 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 and Description |
|---|
MACAddress(Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider)
Constructs a MAC address
|
MACAddress(Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider,
boolean extended)
Constructs a MAC address
|
MACAddress(Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider,
boolean extended,
java.lang.Integer prefixLength)
Constructs a MAC address
|
MACAddress(Address.SegmentValueProvider lowerValueProvider,
Address.SegmentValueProvider upperValueProvider,
java.lang.Integer prefixLength)
Constructs a MAC address
|
MACAddress(byte[] bytes)
Constructs a MAC address.
|
MACAddress(byte[] bytes,
java.lang.Integer prefixLength)
Constructs a MAC address.
|
MACAddress(long address)
Constructs a MAC address.
|
MACAddress(long address,
boolean extended)
Constructs a MAC address.
|
MACAddress(long address,
boolean extended,
java.lang.Integer prefixLength)
Constructs a MAC address.
|
MACAddress(long address,
java.lang.Integer prefixLength)
Constructs a MAC address.
|
MACAddress(MACAddressSection section)
Constructs a MAC address.
|
MACAddress(MACAddressSegment[] segments)
Constructs a MAC address.
|
MACAddress(MACAddressSegment[] segments,
java.lang.Integer prefixLength)
Constructs a MAC address.
|
| Modifier and Type | Method and Description |
|---|---|
MACAddress |
adjustPrefixBySegment(boolean nextSegment)
Increases or decreases prefix length to the next segment boundary.
|
MACAddress |
adjustPrefixLength(int adjustment)
Increases or decreases prefix length by the given increment.
|
MACAddress |
applyPrefixLength(int networkPrefixLength)
Applies the given prefix length to create a new segment series representing all segment series starting with the same prefix.
|
boolean |
contains(Address other) |
boolean |
contains(MACAddress other) |
static MACAddressNetwork.MACAddressCreator |
getAddressCreator() |
int |
getBitCount() |
int |
getBitsPerSegment() |
int |
getByteCount()
returns the number of bytes in each of the address components represented by this instance
|
int |
getBytesPerSegment() |
AddressDivisionGrouping |
getDottedAddress() |
java.lang.Iterable<MACAddress> |
getIterable()
Useful for using an instance in a "for-each loop".
|
MACAddress |
getLower()
If this instance represents multiple address components, returns the one with the lowest numeric value.
|
int |
getMaxSegmentValue() |
MACAddressSection |
getODISection() |
MACAddressSection |
getOUISection() |
MACAddressSection |
getSection() |
MACAddressSection |
getSection(int index)
Gets the subsection from the series starting from the given index
|
MACAddressSection |
getSection(int index,
int endIndex)
Gets the subsection from the series starting from the given index and ending just before the give endIndex
|
MACAddressSegment |
getSegment(int index) |
MACAddressSegment[] |
getSegments() |
MACAddress |
getUpper()
If this instance represents multiple address components, returns the one with the highest numeric value.
|
boolean |
isAllAddresses() |
boolean |
isEUI64(boolean asMAC)
Whether this section is consistent with an IPv6 EUI64 section,
which means it came from an extended 8 byte address,
and the corresponding segments in the middle match 0xff and 0xff/fe for MAC/not-MAC
|
boolean |
isExtended() |
boolean |
isLocal() |
boolean |
isMulticast() |
boolean |
isUniversal() |
java.util.Iterator<MACAddress> |
iterator()
An address component can represent a single segment, address, or section, or it can represent multiple,
typically a subnet or range of segment, address, or section values.
|
static int |
maxSegmentValue() |
static MACAddressNetwork |
network() |
MACAddress |
removePrefixLength()
Removes the prefix.
|
MACAddress |
reverseBits(boolean perByte)
Use to produce:
"MSB format", "IBM format", "Token-Ring format", and "non-canonical form"
See RFC 2469 section 2
Also see https://en.wikipedia.org/wiki/MAC_address
|
MACAddress |
reverseBytes()
Returns a new segment series with the bytes reversed.
|
MACAddress |
reverseBytesPerSegment()
Returns a new segment series with the bytes reversed within each segment.
|
MACAddress |
reverseSegments()
Returns a new segment series with the segments reversed.
|
java.util.Iterator<MACAddressSegment[]> |
segmentsIterator() |
MACAddress |
setPrefixLength(int prefixLength)
Sets the prefix length.
|
MACAddressString |
toAddressString()
Returns a host identifier string representation for this address,
which will be validated already.
|
java.lang.String |
toColonDelimitedString() |
java.lang.String |
toDashedString() |
java.lang.String |
toDottedString() |
MACAddress |
toEUI64(boolean asMAC)
Convert to IPv6 EUI-64 section
http://standards.ieee.org/develop/regauth/tut/eui64.pdf
|
IPv6AddressSection |
toEUI64IPv6() |
IPv6Address |
toLinkLocalIPv6() |
java.lang.String |
toNormalizedString(AddressDivisionGrouping.StringOptions stringOptions) |
MACAddress |
toOUIPrefixed() |
java.lang.String |
toSpaceDelimitedString() |
compareTo, equals, getBytes, getBytes, getCount, getDivision, getDivisionCount, getEquivalentPrefix, getMinPrefix, getPrefixLength, getSegmentCount, getSegments, getSegments, getUpperBytes, getUpperBytes, hashCode, isFullRange, isMore, isMultiple, isMultipleByPrefix, isPrefixed, isRangeEquivalentToPrefix, isSameAddress, isZero, toCanonicalString, toCompressedString, toHexString, toNormalizedString, toStringpublic static final char COLON_SEGMENT_SEPARATOR
public static final char DASH_SEGMENT_SEPARATOR
public static final char SPACE_SEGMENT_SEPARATOR
public static final char DOTTED_SEGMENT_SEPARATOR
public static final char DASHED_SEGMENT_RANGE_SEPARATOR
public static final java.lang.String DASHED_SEGMENT_RANGE_SEPARATOR_STR
public static final int BITS_PER_SEGMENT
public static final int BYTES_PER_SEGMENT
public static final int MEDIA_ACCESS_CONTROL_SEGMENT_COUNT
public static final int MEDIA_ACCESS_CONTROL_DOTTED_SEGMENT_COUNT
public static final int MEDIA_ACCESS_CONTROL_DOTTED_64_SEGMENT_COUNT
public static final int MEDIA_ACCESS_CONTROL_DOTTED_BITS_PER_SEGMENT
public static final int MEDIA_ACCESS_CONTROL_SINGLE_DASHED_SEGMENT_COUNT
public static final int EXTENDED_UNIQUE_IDENTIFIER_48_SEGMENT_COUNT
public static final int EXTENDED_UNIQUE_IDENTIFIER_64_SEGMENT_COUNT
public static final int DEFAULT_TEXTUAL_RADIX
public static final int MAX_VALUE_PER_SEGMENT
public static final int MAX_VALUE_PER_DOTTED_SEGMENT
public static final int ORGANIZATIONAL_UNIQUE_IDENTIFIER_SEGMENT_COUNT
public static final int ORGANIZATIONAL_UNIQUE_IDENTIFIER_BIT_COUNT
public MACAddress(MACAddressSegment[] segments)
segments - the address segmentspublic MACAddress(MACAddressSegment[] segments, java.lang.Integer prefixLength)
segments - the address segmentspublic MACAddress(MACAddressSection section)
section - the address segmentspublic MACAddress(long address)
public MACAddress(long address,
boolean extended)
public MACAddress(long address,
java.lang.Integer prefixLength)
public MACAddress(long address,
boolean extended,
java.lang.Integer prefixLength)
address - the bytesprefixLength - the length for which the address represents all addresses with the same prefix identifier such as the 24 bit Organizational Unique Identifier (OUI)extended - if true, treated as an 8-byte EUI-64 address, otherwise treated as a 6-byte MAC or EUI-48public MACAddress(byte[] bytes)
public MACAddress(byte[] bytes,
java.lang.Integer prefixLength)
public MACAddress(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, boolean extended, java.lang.Integer prefixLength)
lowerValueProvider - supplies the 1 byte lower values for each segmentupperValueProvider - supplies the 1 byte upper values for each segmentpublic MACAddress(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, java.lang.Integer prefixLength)
lowerValueProvider - supplies the 1 byte lower values for each segmentupperValueProvider - supplies the 1 byte upper values for each segmentpublic MACAddress(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider, boolean extended)
lowerValueProvider - supplies the 1 byte lower values for each segmentupperValueProvider - supplies the 1 byte upper values for each segmentpublic MACAddress(Address.SegmentValueProvider lowerValueProvider, Address.SegmentValueProvider upperValueProvider)
lowerValueProvider - supplies the 1 byte lower values for each segmentupperValueProvider - supplies the 1 byte upper values for each segmentpublic static MACAddressNetwork network()
public static MACAddressNetwork.MACAddressCreator getAddressCreator()
public boolean isExtended()
public boolean isAllAddresses()
public MACAddressSection getSection()
getSection in class Addresspublic MACAddressSegment getSegment(int index)
getSegment in interface AddressSegmentSeriesgetSegment in class Addresspublic MACAddressSegment[] getSegments()
getSegments in interface AddressSegmentSeriesgetSegments in class Addresspublic static int maxSegmentValue()
public int getMaxSegmentValue()
getMaxSegmentValue in class Addresspublic int getByteCount()
AddressComponentgetByteCount in interface AddressComponentgetByteCount in class Addresspublic int getBitCount()
getBitCount in interface AddressItemgetBitCount in class Addresspublic int getBytesPerSegment()
getBytesPerSegment in interface AddressSegmentSeriespublic int getBitsPerSegment()
getBitsPerSegment in interface AddressSegmentSeriespublic boolean contains(MACAddress other)
other - public java.lang.Iterable<MACAddress> getIterable()
AddressComponentAddressComponent.iterator() directly.getIterable in interface AddressComponentgetIterable in interface AddressSegmentSeriesgetIterable in class Addresspublic java.util.Iterator<MACAddress> iterator()
AddressComponentAddressItem.isMultiple() to determine if this instance represents multiple.
This method iterates through the individual elements.iterator in interface AddressComponentiterator in interface AddressSegmentSeriesiterator in interface java.lang.Iterable<MACAddress>iterator in class Addresspublic java.util.Iterator<MACAddressSegment[]> segmentsIterator()
segmentsIterator in interface AddressSegmentSeriessegmentsIterator in class Addresspublic MACAddress getLower()
AddressComponentgetLower in interface AddressComponentgetLower in interface AddressSegmentSeriesgetLower in class Addresspublic MACAddress getUpper()
AddressComponentgetUpper in interface AddressComponentgetUpper in interface AddressSegmentSeriesgetUpper in class Addresspublic MACAddress reverseBits(boolean perByte)
reverseBits in interface AddressComponentreverseBits in interface AddressSegmentSeriesreverseBits in class AddressperByte - if true, only the bits in each byte are reversed, if false, then all bits in the component are reversedpublic MACAddress reverseBytes()
AddressSegmentSeriesreverseBytes in interface AddressComponentreverseBytes in interface AddressSegmentSeriesreverseBytes in class Addresspublic MACAddress reverseBytesPerSegment()
AddressSegmentSeriesreverseBytesPerSegment in interface AddressSegmentSeriesreverseBytesPerSegment in class Addresspublic MACAddress reverseSegments()
AddressSegmentSeriesreverseSegments in interface AddressSegmentSeriesreverseSegments in class Addresspublic MACAddress removePrefixLength()
AddressSegmentSeriesremovePrefixLength in interface AddressSegmentSeriesremovePrefixLength in class Addresspublic MACAddress applyPrefixLength(int networkPrefixLength)
AddressSegmentSeriesapplyPrefixLength in interface AddressSegmentSeriesapplyPrefixLength in class Addresspublic MACAddress adjustPrefixBySegment(boolean nextSegment)
AddressSegmentSeriesadjustPrefixBySegment in interface AddressSegmentSeriesadjustPrefixBySegment in class Addresspublic MACAddress adjustPrefixLength(int adjustment)
AddressSegmentSeriesadjustPrefixLength in interface AddressSegmentSeriesadjustPrefixLength in class Addresspublic MACAddress setPrefixLength(int prefixLength)
AddressSegmentSeriessetPrefixLength in interface AddressSegmentSeriessetPrefixLength in class Addresspublic MACAddressSection getSection(int index)
AddressSegmentSeriesgetSection in interface AddressSegmentSeriesgetSection in class Addresspublic MACAddressSection getSection(int index, int endIndex)
AddressSegmentSeriesgetSection in interface AddressSegmentSeriesgetSection in class Addresspublic MACAddressSection getODISection()
public MACAddressSection getOUISection()
public MACAddress toOUIPrefixed()
public IPv6Address toLinkLocalIPv6()
public IPv6AddressSection toEUI64IPv6()
public boolean isEUI64(boolean asMAC)
asMAC - public MACAddress toEUI64(boolean asMAC)
asMAC - if true, this address is considered MAC and the EUI-64 is extended using ff-ff, otherwise this address is considered EUI-48 and extended using ff-fe
Note that IPv6 treats MAC as EUI-48 and extends MAC to IPv6 addresses using ff-fepublic AddressDivisionGrouping getDottedAddress()
public MACAddressString toAddressString()
AddresstoAddressString in class Addresspublic java.lang.String toNormalizedString(AddressDivisionGrouping.StringOptions stringOptions)
public java.lang.String toDottedString()
public java.lang.String toDashedString()
public java.lang.String toColonDelimitedString()
public java.lang.String toSpaceDelimitedString()
public boolean isMulticast()
isMulticast in class AddressInetAddress.isMulticastAddress()public boolean isUniversal()