|
SourceForge Jpcap | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.jpcap.net.IPAddress
public class IPAddress
IP address.
This class doesn't store IP addresses. There's a java class for that, and it is too big and cumbersome for our purposes.
This class contains a utility method for extracting an IP address from a big-endian byte array.
| Field Summary | |
|---|---|
static int |
WIDTH
The width in bytes of an IP address. |
| Constructor Summary | |
|---|---|
IPAddress()
|
|
| Method Summary | |
|---|---|
static String |
extract(int offset,
byte[] bytes)
Extract a string describing an IP address from an array of bytes. |
static void |
main(String[] args)
Unit test. |
static int |
random()
Generate a random IP number between 0.0.0.0 and 255.255.255.255. |
static int |
random(int network,
int mask)
Generate a random IP address. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int WIDTH
| Constructor Detail |
|---|
public IPAddress()
| Method Detail |
|---|
public static String extract(int offset,
byte[] bytes)
offset - the offset of the address data.bytes - an array of bytes containing the IP address.
public static int random()
public static int random(int network,
int mask)
network - the network number. i.e. 0x0a000000.mask - the network mask. i.e. 0xffffff00.
public static void main(String[] args)
|
Copyright © Patrick Charles & Jonas Lehmann, 2001; Esmond Pitt, 2008. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||