Пример #1
0
 /**
  * Converts a byte array and a given offset from the beginning of the array into an IPv6 address.
  *
  * <p>The IP address is stored in network byte order (i.e., the most significant byte first).
  *
  * @param value the value to use
  * @param offset the offset in bytes from the beginning of the byte array
  * @return an IPv6 address
  * @throws IllegalArgumentException if the arguments are invalid
  */
 public static Ip6Address valueOf(byte[] value, int offset) {
   IpAddress.checkArguments(VERSION, value, offset);
   byte[] bc = Arrays.copyOfRange(value, offset, value.length);
   return Ip6Address.valueOf(bc);
 }
Пример #2
0
 /**
  * Creates an IPv6 address by masking it with a network mask of given mask length.
  *
  * @param address the address to mask
  * @param prefixLength the length of the mask prefix. Must be in the interval [0, 128]
  * @return a new IPv6 address that is masked with a mask prefix of the specified length
  * @throws IllegalArgumentException if the prefix length is invalid
  */
 public static Ip6Address makeMaskedAddress(final Ip6Address address, int prefixLength) {
   byte[] net = makeMaskedAddressArray(address, prefixLength);
   return Ip6Address.valueOf(net);
 }