src/share/classes/java/net/DatagramPacket.java

Print this page




  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   JDK1.0
  41  */
  42 public final
  43 class DatagramPacket {
  44 
  45     /**
  46      * Perform class initialization
  47      */
  48     static {
  49         java.security.AccessController.doPrivileged(
  50                   new sun.security.action.LoadLibraryAction("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</code> for receiving packets of
  67      * length <code>length</code>, specifying an offset into the buffer.
  68      * <p>
  69      * The <code>length</code> argument must be less than or equal to
  70      * <code>buf.length</code>.




  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   JDK1.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<Void>() {
  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</code> for receiving packets of
  72      * length <code>length</code>, specifying an offset into the buffer.
  73      * <p>
  74      * The <code>length</code> argument must be less than or equal to
  75      * <code>buf.length</code>.