Java Doc for DatagramPacket.java in  » Apache-Harmony-Java-SE » java-package » java » net » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » java package » java.net 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.net.DatagramPacket

DatagramPacket
final public class DatagramPacket (Code)
This class models a datagram packet to be sent or received. The DatagramPacket(byte[], int, InetAddress, int) constructor is used for packets to be sent, while the DatagramPacket(byte[], int) constructor is used for received packets.
See Also:   DatagramSocket


Field Summary
 InetAddressaddress
    
 intcapacity
     Size of internal buffer that is used to store received data.
 byte[]data
    
 intlength
     Length of the data to be sent or size of data that was received via DatagramSocket#receive() method call.
 intoffset
    
 intport
    

Constructor Summary
public  DatagramPacket(byte[] data, int length)
     Constructs a new DatagramPacket suitable for receiving datagram packets of length up to length.
public  DatagramPacket(byte[] data, int offset, int length)
     Constructs a new DatagramPacket suitable for receiving datagram packets of length up to length, with an offset into the buffer offset.
public  DatagramPacket(byte[] data, int offset, int length, InetAddress host, int aPort)
     Constructs a new DatagramPacket suitable for sending packets to the nominated host/port.
public  DatagramPacket(byte[] data, int length, InetAddress host, int port)
     Constructs a new DatagramPacket suitable for sending packets to the nominated host/port.
public  DatagramPacket(byte[] data, int length, SocketAddress sockAddr)
     Constructs a new DatagramPacket suitable for sending packets to the nominated host/port.
public  DatagramPacket(byte[] data, int offset, int length, SocketAddress sockAddr)
     Constructs a new DatagramPacket suitable for sending packets to the nominated host/port.

Method Summary
public synchronized  InetAddressgetAddress()
     Answer the IP address of the machine that is the target or sender of this datagram.
public synchronized  byte[]getData()
     Answer the data sent or received in this datagram.
public synchronized  intgetLength()
     Answer the length of the data sent or received in this datagram.
public synchronized  intgetOffset()
     Answer the offset of the data sent or received in this datagram buffer.
public synchronized  intgetPort()
     Answer the port number of the target or sender machine of this datagram.
public synchronized  SocketAddressgetSocketAddress()
     Answer the SocketAddress for this packet.
public synchronized  voidsetAddress(InetAddress addr)
     Set the IP address of the machine that is the target of this datagram.
public synchronized  voidsetData(byte[] buf, int anOffset, int aLength)
     Set the data buffer for this datagram.
public synchronized  voidsetData(byte[] buf)
     Set the data sent in this datagram.
public synchronized  voidsetLength(int len)
     Set the length of the data sent in this datagram.
public synchronized  voidsetPort(int aPort)
     Set the port number of the target machine of this datagram.
public synchronized  voidsetSocketAddress(SocketAddress sockAddr)
     Set the SocketAddress for this packet.

Field Detail
address
InetAddress address(Code)



capacity
int capacity(Code)
Size of internal buffer that is used to store received data. Should be greater or equal to "length" field.



data
byte[] data(Code)



length
int length(Code)
Length of the data to be sent or size of data that was received via DatagramSocket#receive() method call.



offset
int offset(Code)



port
int port(Code)




Constructor Detail
DatagramPacket
public DatagramPacket(byte[] data, int length)(Code)
Constructs a new DatagramPacket suitable for receiving datagram packets of length up to length.
Parameters:
  data - byte array to store the read characters
Parameters:
  length - length of the data buffer



DatagramPacket
public DatagramPacket(byte[] data, int offset, int length)(Code)
Constructs a new DatagramPacket suitable for receiving datagram packets of length up to length, with an offset into the buffer offset.
Parameters:
  data - byte array to store the read characters
Parameters:
  offset - the offset into the byte array
Parameters:
  length - length of the data buffer



DatagramPacket
public DatagramPacket(byte[] data, int offset, int length, InetAddress host, int aPort)(Code)
Constructs a new DatagramPacket suitable for sending packets to the nominated host/port. The length must be less than or equal to the size of data.
Parameters:
  data - byte array to store the read characters
Parameters:
  offset - the offset in to read/write from
Parameters:
  length - length of the data buffer
Parameters:
  host - address of the target host
Parameters:
  aPort - target host port



DatagramPacket
public DatagramPacket(byte[] data, int length, InetAddress host, int port)(Code)
Constructs a new DatagramPacket suitable for sending packets to the nominated host/port. The length must be less than or equal to the size of data.
Parameters:
  data - byte array to store the read characters
Parameters:
  length - length of the data buffer
Parameters:
  host - address of the target host
Parameters:
  port - target host port



DatagramPacket
public DatagramPacket(byte[] data, int length, SocketAddress sockAddr) throws SocketException(Code)
Constructs a new DatagramPacket suitable for sending packets to the nominated host/port. The length must be less than or equal to the size of data.
Parameters:
  data - byte array to store the read characters
Parameters:
  length - length of the data buffer
Parameters:
  sockAddr - the machine address and port



DatagramPacket
public DatagramPacket(byte[] data, int offset, int length, SocketAddress sockAddr) throws SocketException(Code)
Constructs a new DatagramPacket suitable for sending packets to the nominated host/port. The length must be less than or equal to the size of data.
Parameters:
  data - byte array to store the read characters
Parameters:
  offset - the offset in to read/write from
Parameters:
  length - length of the data buffer
Parameters:
  sockAddr - the machine address and port




Method Detail
getAddress
public synchronized InetAddress getAddress()(Code)
Answer the IP address of the machine that is the target or sender of this datagram. InetAddress the target host address



getData
public synchronized byte[] getData()(Code)
Answer the data sent or received in this datagram. byte[] the data sent/received



getLength
public synchronized int getLength()(Code)
Answer the length of the data sent or received in this datagram. int the length of the sent/received data



getOffset
public synchronized int getOffset()(Code)
Answer the offset of the data sent or received in this datagram buffer. int the offset of the start of the sent/received data



getPort
public synchronized int getPort()(Code)
Answer the port number of the target or sender machine of this datagram. int for received packets, the sender address and for sentpackets, the target host



getSocketAddress
public synchronized SocketAddress getSocketAddress()(Code)
Answer the SocketAddress for this packet.



setAddress
public synchronized void setAddress(InetAddress addr)(Code)
Set the IP address of the machine that is the target of this datagram.
Parameters:
  addr - the target host address



setData
public synchronized void setData(byte[] buf, int anOffset, int aLength)(Code)
Set the data buffer for this datagram.
Parameters:
  buf - the data to be sent
Parameters:
  anOffset - the offset into the data
Parameters:
  aLength - the length of the data to be sent



setData
public synchronized void setData(byte[] buf)(Code)
Set the data sent in this datagram.
Parameters:
  buf - the data to be sent



setLength
public synchronized void setLength(int len)(Code)
Set the length of the data sent in this datagram.
Parameters:
  len - the length of the data to be sent



setPort
public synchronized void setPort(int aPort)(Code)
Set the port number of the target machine of this datagram.
Parameters:
  aPort - the target host port



setSocketAddress
public synchronized void setSocketAddress(SocketAddress sockAddr)(Code)
Set the SocketAddress for this packet.
Parameters:
  sockAddr - the machine address and port



Methods inherited from java.lang.Object
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.