88
89 /** use serialVersionUID from InetAddress, but Inet4Address instance
90 * is always replaced by an InetAddress instance before being
91 * serialized */
92 private static final long serialVersionUID = 3286316764910316507L;
93
94 /*
95 * Perform initializations.
96 */
97 static {
98 init();
99 }
100
101 Inet4Address() {
102 super();
103 holder().hostName = null;
104 holder().address = 0;
105 holder().family = IPv4;
106 }
107
108 Inet4Address(String hostName, byte addr[]) {
109 holder().hostName = hostName;
110 holder().family = IPv4;
111 if (addr != null) {
112 if (addr.length == INADDRSZ) {
113 int address = addr[3] & 0xFF;
114 address |= ((addr[2] << 8) & 0xFF00);
115 address |= ((addr[1] << 16) & 0xFF0000);
116 address |= ((addr[0] << 24) & 0xFF000000);
117 holder().address = address;
118 }
119 }
120 holder().originalHostName = hostName;
121 }
122 Inet4Address(String hostName, int address) {
123 holder().hostName = hostName;
124 holder().family = IPv4;
125 holder().address = address;
126 holder().originalHostName = hostName;
127 }
128
|
88
89 /** use serialVersionUID from InetAddress, but Inet4Address instance
90 * is always replaced by an InetAddress instance before being
91 * serialized */
92 private static final long serialVersionUID = 3286316764910316507L;
93
94 /*
95 * Perform initializations.
96 */
97 static {
98 init();
99 }
100
101 Inet4Address() {
102 super();
103 holder().hostName = null;
104 holder().address = 0;
105 holder().family = IPv4;
106 }
107
108 Inet4Address(String hostName, byte[] addr) {
109 holder().hostName = hostName;
110 holder().family = IPv4;
111 if (addr != null) {
112 if (addr.length == INADDRSZ) {
113 int address = addr[3] & 0xFF;
114 address |= ((addr[2] << 8) & 0xFF00);
115 address |= ((addr[1] << 16) & 0xFF0000);
116 address |= ((addr[0] << 24) & 0xFF000000);
117 holder().address = address;
118 }
119 }
120 holder().originalHostName = hostName;
121 }
122 Inet4Address(String hostName, int address) {
123 holder().hostName = hostName;
124 holder().family = IPv4;
125 holder().address = address;
126 holder().originalHostName = hostName;
127 }
128
|