29 * This class represents a datagram packet.
30 * <p>
31 * Datagram packets are used to implement a connectionless packet
32 * delivery service. Each message is routed from one machine to
33 * another based solely on information contained within that packet.
34 * Multiple packets sent from one machine to another might be routed
35 * differently, and might arrive in any order. Packet delivery is
36 * not guaranteed.
37 *
38 * @author Pavani Diwanji
39 * @author Benjamin Renaud
40 * @since 1.0
41 */
42 public final
43 class DatagramPacket {
44
45 /**
46 * Perform class initialization
47 */
48 static {
49 java.security.AccessController.doPrivileged(
50 new java.security.PrivilegedAction<>() {
51 public Void run() {
52 System.loadLibrary("net");
53 return null;
54 }
55 });
56 init();
57 }
58
59 /*
60 * The fields of this class are package-private since DatagramSocketImpl
61 * classes needs to access them.
62 */
63 byte[] buf;
64 int offset;
65 int length;
66 int bufLength;
67 InetAddress address;
68 int port;
69
70 /**
71 * Constructs a {@code DatagramPacket} for receiving packets of
72 * length {@code length}, specifying an offset into the buffer.
73 * <p>
74 * The {@code length} argument must be less than or equal to
75 * {@code buf.length}.
|
29 * This class represents a datagram packet.
30 * <p>
31 * Datagram packets are used to implement a connectionless packet
32 * delivery service. Each message is routed from one machine to
33 * another based solely on information contained within that packet.
34 * Multiple packets sent from one machine to another might be routed
35 * differently, and might arrive in any order. Packet delivery is
36 * not guaranteed.
37 *
38 * @author Pavani Diwanji
39 * @author Benjamin Renaud
40 * @since 1.0
41 */
42 public final
43 class DatagramPacket {
44
45 /**
46 * Perform class initialization
47 */
48 static {
49 jdk.internal.loader.BootLoader.loadLibrary("net");
50 init();
51 }
52
53 /*
54 * The fields of this class are package-private since DatagramSocketImpl
55 * classes needs to access them.
56 */
57 byte[] buf;
58 int offset;
59 int length;
60 int bufLength;
61 InetAddress address;
62 int port;
63
64 /**
65 * Constructs a {@code DatagramPacket} for receiving packets of
66 * length {@code length}, specifying an offset into the buffer.
67 * <p>
68 * The {@code length} argument must be less than or equal to
69 * {@code buf.length}.
|