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.access.SharedSecrets.getJavaLangAccess()
50 .loadLibrary(DatagramPacket.class, "net");
51 init();
52 }
53
54 /*
55 * The fields of this class are package-private since DatagramSocketImpl
56 * classes needs to access them.
57 */
58 byte[] buf;
59 int offset;
60 int length;
61 int bufLength;
62 InetAddress address;
63 int port;
64
65 /**
66 * Constructs a {@code DatagramPacket} for receiving packets of
67 * length {@code length}, specifying an offset into the buffer.
68 * <p>
69 * The {@code length} argument must be less than or equal to
70 * {@code buf.length}.
|