com.googlecode.ipv6
Class IPv6Network

java.lang.Object
  extended by com.googlecode.ipv6.IPv6AddressRange
      extended by com.googlecode.ipv6.IPv6Network
All Implemented Interfaces:
Comparable<IPv6AddressRange>, Iterable<IPv6Address>

public final class IPv6Network
extends IPv6AddressRange

Immutable representation of an IPv6 network based on an address and a prefix length. An IPv6 network is also an IPv6 address range (but not all ranges are valid networks).

Author:
Jan Van Besien

Method Summary
 boolean equals(Object o)
           
static IPv6Network fromAddressAndMask(IPv6Address address, IPv6NetworkMask networkMask)
          Create an IPv6 network from an IPv6Address and an IPv6NetworkMask
static IPv6Network fromString(String string)
          Create an IPv6 network from its String representation.
static IPv6Network fromTwoAddresses(IPv6Address one, IPv6Address two)
          Create an IPv6 network from the two addresses within the network.
 IPv6NetworkMask getNetmask()
           
 int hashCode()
           
 String toLongString()
           
 String toString()
           
 
Methods inherited from class com.googlecode.ipv6.IPv6AddressRange
compareTo, contains, contains, extend, fromFirstAndLast, getFirst, getLast, iterator, overlaps, remove, remove
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

fromAddressAndMask

public static IPv6Network fromAddressAndMask(IPv6Address address,
                                             IPv6NetworkMask networkMask)
Create an IPv6 network from an IPv6Address and an IPv6NetworkMask

Parameters:
address - IPv6 address (the network address or any other address within the network)
networkMask - IPv6 network mask
Returns:
IPv6 network

fromTwoAddresses

public static IPv6Network fromTwoAddresses(IPv6Address one,
                                           IPv6Address two)
Create an IPv6 network from the two addresses within the network. This will construct the smallest possible network ("longest prefix length") which contains both addresses.

Parameters:
one - address one
two - address two, should be bigger than address one

fromString

public static IPv6Network fromString(String string)
Create an IPv6 network from its String representation. For example "1234:5678:abcd:0:0:0:0:0/64" or "2001::ff/128".

Parameters:
string - string representation
Returns:
IPv6 network

toString

public String toString()
Overrides:
toString in class IPv6AddressRange

toLongString

public String toLongString()
Overrides:
toLongString in class IPv6AddressRange
Returns:
like toString but without using shorthand notations for addresses

equals

public boolean equals(Object o)
Overrides:
equals in class IPv6AddressRange

hashCode

public int hashCode()
Overrides:
hashCode in class IPv6AddressRange

getNetmask

public IPv6NetworkMask getNetmask()


Copyright © 2012. All Rights Reserved.