147 * the InetAddress with this family.
148 */
149 inet.holder().family = 2;
150
151 return inet;
152 }
153
154 /**
155 * Utility routine to check if the InetAddress is an
156 * IP multicast address. IP multicast address is a Class D
157 * address i.e first four bits of the address are 1110.
158 * @return a {@code boolean} indicating if the InetAddress is
159 * an IP multicast address
160 */
161 public boolean isMulticastAddress() {
162 return ((holder().getAddress() & 0xf0000000) == 0xe0000000);
163 }
164
165 /**
166 * Utility routine to check if the InetAddress is a wildcard address.
167 * @return a {@code boolean} indicating if the Inetaddress is
168 * a wildcard address.
169 */
170 public boolean isAnyLocalAddress() {
171 return holder().getAddress() == 0;
172 }
173
174 /**
175 * Utility routine to check if the InetAddress is a loopback address.
176 *
177 * @return a {@code boolean} indicating if the InetAddress is
178 * a loopback address; or false otherwise.
179 */
180 public boolean isLoopbackAddress() {
181 /* 127.x.x.x */
182 byte[] byteAddr = getAddress();
183 return byteAddr[0] == 127;
184 }
185
186 /**
187 * Utility routine to check if the InetAddress is an link local address.
|
147 * the InetAddress with this family.
148 */
149 inet.holder().family = 2;
150
151 return inet;
152 }
153
154 /**
155 * Utility routine to check if the InetAddress is an
156 * IP multicast address. IP multicast address is a Class D
157 * address i.e first four bits of the address are 1110.
158 * @return a {@code boolean} indicating if the InetAddress is
159 * an IP multicast address
160 */
161 public boolean isMulticastAddress() {
162 return ((holder().getAddress() & 0xf0000000) == 0xe0000000);
163 }
164
165 /**
166 * Utility routine to check if the InetAddress is a wildcard address.
167 * @return a {@code boolean} indicating if the InetAddress is
168 * a wildcard address.
169 */
170 public boolean isAnyLocalAddress() {
171 return holder().getAddress() == 0;
172 }
173
174 /**
175 * Utility routine to check if the InetAddress is a loopback address.
176 *
177 * @return a {@code boolean} indicating if the InetAddress is
178 * a loopback address; or false otherwise.
179 */
180 public boolean isLoopbackAddress() {
181 /* 127.x.x.x */
182 byte[] byteAddr = getAddress();
183 return byteAddr[0] == 127;
184 }
185
186 /**
187 * Utility routine to check if the InetAddress is an link local address.
|