1 |
/* Inet4Address.java |
/* Inet4Address.java -- |
2 |
Copyright (C) 2002, 2003 Free Software Foundation, Inc. |
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
38 |
|
|
39 |
package java.net; |
package java.net; |
40 |
|
|
41 |
import java.io.ObjectStreamException; |
import java.io.ObjectStreamException; |
42 |
import java.util.Arrays; |
import java.util.Arrays; |
43 |
|
|
|
|
|
|
/** |
|
|
* @author Michael Koch |
|
|
* @date August 3, 2002. |
|
|
*/ |
|
|
|
|
44 |
/* |
/* |
45 |
* Written using on-line Java Platform 1.4 API Specification and |
* Written using on-line Java Platform 1.4 API Specification and |
46 |
* RFC 1884 (http://www.ietf.org/rfc/rfc1884.txt), |
* RFC 1884 (http://www.ietf.org/rfc/rfc1884.txt), |
47 |
* RFC 1918 (http://www.ietf.org/rfc/rfc1918.txt), |
* RFC 1918 (http://www.ietf.org/rfc/rfc1918.txt), |
48 |
* RFC 2365 (http://www.ietf.org/rfc/rfc2365.txt) |
* RFC 2365 (http://www.ietf.org/rfc/rfc2365.txt) |
49 |
* Status: Believed complete and correct. |
* |
50 |
|
* @author Michael Koch |
51 |
|
* @status Believed complete and correct. |
52 |
*/ |
*/ |
53 |
public final class Inet4Address extends InetAddress |
public final class Inet4Address extends InetAddress |
54 |
{ |
{ |
62 |
*/ |
*/ |
63 |
private Object writeReplace() throws ObjectStreamException |
private Object writeReplace() throws ObjectStreamException |
64 |
{ |
{ |
65 |
return new InetAddress(addr, hostName, null); |
return new InetAddress(addr, hostName); |
66 |
} |
} |
67 |
|
|
68 |
/** |
/** |
69 |
* Initializes this object's addr instance variable from the passed in |
* Initializes this object's addr instance variable from the passed in |
|
* byte array. Note that this constructor is package-private and is called |
|
|
* only by static methods in InetAddress. |
|
|
* |
|
|
* @param addr |
|
|
*/ |
|
|
Inet4Address(byte[] addr) |
|
|
{ |
|
|
this(addr, null, null); |
|
|
} |
|
|
|
|
|
/** |
|
|
* Creates a Inet4Address |
|
|
* |
|
|
* @param addr The IP address |
|
|
* @param host The Hostname |
|
|
*/ |
|
|
Inet4Address(byte[] addr, String host) |
|
|
{ |
|
|
this(addr, host, null); |
|
|
} |
|
|
|
|
|
/** |
|
|
* Initializes this object's addr instance variable from the passed in |
|
70 |
* byte array. Note that this constructor is protected and is called |
* byte array. Note that this constructor is protected and is called |
71 |
* only by static methods in this class. |
* only by static methods in this class. |
72 |
* |
* |
73 |
* @param addr The IP number of this address as an array of bytes |
* @param addr The IP number of this address as an array of bytes |
74 |
* @param hostname The hostname of this IP address. |
* @param hostname The hostname of this IP address. |
|
* @param hostname_alias A backup hostname to use if hostname is null to |
|
|
* prevent reverse lookup failures |
|
75 |
*/ |
*/ |
76 |
Inet4Address(byte[] addr, String hostname, String hostname_alias) |
Inet4Address(byte[] addr, String host) |
77 |
{ |
{ |
78 |
super(addr, hostname, hostname_alias); |
super(addr, host); |
79 |
} |
} |
80 |
|
|
81 |
/** |
/** |
82 |
* Checks if the address is a multicast address |
* Checks if the address is a multicast address |
83 |
* |
* |