Lines Matching full:address
15 public final class Address {
21 Address() {}
115 // An IPv4 address must be the last component
121 byte [] v4addr = Address.toByteArray(tokens[i], IPv4);
160 * Convert a string containing an IP address to an array of 4 or 16 integers.
161 * @param s The address, in text format.
162 * @param family The address family.
163 * @return The address
177 * Convert a string containing an IPv4 address to an array of 4 integers.
178 * @param s The address, in text format.
179 * @return The address
187 * Convert a string containing an IP address to an array of 4 or 16 bytes.
188 * @param s The address, in text format.
189 * @param family The address family.
190 * @return The address
199 throw new IllegalArgumentException("unknown address family");
203 * Determines if a string contains a valid IP address.
205 * @return Whether the string contains a valid IP address
209 byte [] address = Address.toByteArray(s, IPv4);
210 return (address != null);
214 * Converts a byte array containing an IPv4 address into a dotted quad string.
225 * Converts an int array containing an IPv4 address into a dotted quad string.
254 * Determines the IP address of a host
256 * @return The first matching IP address
270 * Determines all IP address of a host
290 * Converts an address from its string representation to an IP address.
291 * The address can be either IPv4 or IPv6.
292 * @param addr The address, in string form
294 * @exception UnknownHostException The address is not a valid IP address.
305 throw new UnknownHostException("Invalid address: " + addr);
309 * Converts an address from its string representation to an IP address in
311 * @param addr The address, in string form
312 * @param family The address family, either IPv4 or IPv6.
314 * @exception UnknownHostException The address is not a valid IP address in
315 * the specified address family.
320 throw new IllegalArgumentException("unknown address family");
325 throw new UnknownHostException("Invalid address: " + addr);
329 * Determines the hostname for an address
330 * @param addr The address to look up
332 * @exception UnknownHostException There is no hostname for the address
339 throw new UnknownHostException("unknown address");
346 * @param address The supplied address.
350 familyOf(InetAddress address) {
351 if (address instanceof Inet4Address)
353 if (address instanceof Inet6Address)
355 throw new IllegalArgumentException("unknown address family");
359 * Returns the length of an address in a particular family.
360 * @param family The address family, either IPv4 or IPv6.
369 throw new IllegalArgumentException("unknown address family");
373 * Truncates an address to the specified number of bits. For example,
374 * truncating the address 10.1.2.3 to 8 bits would yield 10.0.0.0.
375 * @param address The source address
376 * @param maskLength The number of bits to truncate the address to.
379 truncate(InetAddress address, int maskLength)
381 int family = familyOf(address);
386 return address;
387 byte [] bytes = address.getAddress();
398 throw new IllegalArgumentException("invalid address");