Java Doc for TFTPClient.java in  » Net » Apache-commons-net-1.4.1 » org » apache » commons » net » tftp » 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 » Net » Apache commons net 1.4.1 » org.apache.commons.net.tftp 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.commons.net.tftp.TFTP
   org.apache.commons.net.tftp.TFTPClient

TFTPClient
public class TFTPClient extends TFTP (Code)
The TFTPClient class encapsulates all the aspects of the TFTP protocol necessary to receive and send files through TFTP. It is derived from the org.apache.commons.net.tftp.TFTP because it is more convenient than using aggregation, and as a result exposes the same set of methods to allow you to deal with the TFTP protocol directly. However, almost every user should only be concerend with the the org.apache.commons.net.DatagramSocketClient.open open() , org.apache.commons.net.DatagramSocketClient.close close() , TFTPClient.sendFile sendFile() , and TFTPClient.receiveFile receiveFile() methods. Additionally, the TFTPClient.setMaxTimeouts setMaxTimeouts() and org.apache.commons.net.DatagramSocketClient.setDefaultTimeout setDefaultTimeout() methods may be of importance for performance tuning.

Details regarding the TFTP protocol and the format of TFTP packets can be found in RFC 783. But the point of these classes is to keep you from having to worry about the internals.


author:
   Daniel F. Savarese
See Also:   TFTP
See Also:   TFTPPacket
See Also:   TFTPPacketException



Field Summary
final public static  intDEFAULT_MAX_TIMEOUTS
     The default number of times a receive attempt is allowed to timeout before ending attempts to retry the receive and failing.

Constructor Summary
public  TFTPClient()
     Creates a TFTPClient instance with a default timeout of DEFAULT_TIMEOUT, maximum timeouts value of DEFAULT_MAX_TIMEOUTS, a null socket, and buffered operations disabled.

Method Summary
public  intgetMaxTimeouts()
     Returns the maximum number of times a receive attempt is allowed to timeout before ending attempts to retry the receive and failing.
public  intreceiveFile(String filename, int mode, OutputStream output, InetAddress host, int port)
     Requests a named file from a remote host, writes the file to an OutputStream, closes the connection, and returns the number of bytes read.
public  intreceiveFile(String filename, int mode, OutputStream output, String hostname, int port)
     Requests a named file from a remote host, writes the file to an OutputStream, closes the connection, and returns the number of bytes read.
public  intreceiveFile(String filename, int mode, OutputStream output, InetAddress host)
     Same as calling receiveFile(filename, mode, output, host, TFTP.DEFAULT_PORT).
Parameters:
  filename - The name of the file to receive.
Parameters:
  mode - The TFTP mode of the transfer (one of the MODE constants).
Parameters:
  output - The OutputStream to which the file should be written.
Parameters:
  host - The remote host serving the file.
exception:
  IOException - If an I/O error occurs.
public  intreceiveFile(String filename, int mode, OutputStream output, String hostname)
     Same as calling receiveFile(filename, mode, output, hostname, TFTP.DEFAULT_PORT).
Parameters:
  filename - The name of the file to receive.
Parameters:
  mode - The TFTP mode of the transfer (one of the MODE constants).
Parameters:
  output - The OutputStream to which the file should be written.
Parameters:
  hostname - The name of the remote host serving the file.
exception:
  IOException - If an I/O error occurs.
public  voidsendFile(String filename, int mode, InputStream input, InetAddress host, int port)
     Requests to send a file to a remote host, reads the file from an InputStream, sends the file to the remote host, and closes the connection.
public  voidsendFile(String filename, int mode, InputStream input, String hostname, int port)
     Requests to send a file to a remote host, reads the file from an InputStream, sends the file to the remote host, and closes the connection.
public  voidsendFile(String filename, int mode, InputStream input, InetAddress host)
     Same as calling sendFile(filename, mode, input, host, TFTP.DEFAULT_PORT).
Parameters:
  filename - The name the remote server should use when creatingthe file on its file system.
Parameters:
  mode - The TFTP mode of the transfer (one of the MODE constants).
Parameters:
  host - The name of the remote host receiving the file.
exception:
  IOException - If an I/O error occurs.
public  voidsendFile(String filename, int mode, InputStream input, String hostname)
     Same as calling sendFile(filename, mode, input, hostname, TFTP.DEFAULT_PORT).
Parameters:
  filename - The name the remote server should use when creatingthe file on its file system.
Parameters:
  mode - The TFTP mode of the transfer (one of the MODE constants).
Parameters:
  hostname - The name of the remote host receiving the file.
exception:
  IOException - If an I/O error occurs.
public  voidsetMaxTimeouts(int numTimeouts)
     Sets the maximum number of times a receive attempt is allowed to timeout during a receiveFile() or sendFile() operation before ending attempts to retry the receive and failing. The default is DEFAULT_MAX_TIMEOUTS.


Parameters:
  numTimeouts - The maximum number of timeouts to allow.


Field Detail
DEFAULT_MAX_TIMEOUTS
final public static int DEFAULT_MAX_TIMEOUTS(Code)
The default number of times a receive attempt is allowed to timeout before ending attempts to retry the receive and failing. The default is 5 timeouts.




Constructor Detail
TFTPClient
public TFTPClient()(Code)
Creates a TFTPClient instance with a default timeout of DEFAULT_TIMEOUT, maximum timeouts value of DEFAULT_MAX_TIMEOUTS, a null socket, and buffered operations disabled.




Method Detail
getMaxTimeouts
public int getMaxTimeouts()(Code)
Returns the maximum number of times a receive attempt is allowed to timeout before ending attempts to retry the receive and failing.

The maximum number of timeouts allowed.




receiveFile
public int receiveFile(String filename, int mode, OutputStream output, InetAddress host, int port) throws IOException(Code)
Requests a named file from a remote host, writes the file to an OutputStream, closes the connection, and returns the number of bytes read. A local UDP socket must first be created by org.apache.commons.net.DatagramSocketClient.open open() before invoking this method. This method will not close the OutputStream containing the file; you must close it after the method invocation.


Parameters:
  filename - The name of the file to receive.
Parameters:
  mode - The TFTP mode of the transfer (one of the MODE constants).
Parameters:
  output - The OutputStream to which the file should be written.
Parameters:
  host - The remote host serving the file.
Parameters:
  port - The port number of the remote TFTP server.
exception:
  IOException - If an I/O error occurs. The nature of theerror will be reported in the message.




receiveFile
public int receiveFile(String filename, int mode, OutputStream output, String hostname, int port) throws UnknownHostException, IOException(Code)
Requests a named file from a remote host, writes the file to an OutputStream, closes the connection, and returns the number of bytes read. A local UDP socket must first be created by org.apache.commons.net.DatagramSocketClient.open open() before invoking this method. This method will not close the OutputStream containing the file; you must close it after the method invocation.


Parameters:
  filename - The name of the file to receive.
Parameters:
  mode - The TFTP mode of the transfer (one of the MODE constants).
Parameters:
  output - The OutputStream to which the file should be written.
Parameters:
  hostname - The name of the remote host serving the file.
Parameters:
  port - The port number of the remote TFTP server.
exception:
  IOException - If an I/O error occurs. The nature of theerror will be reported in the message.
exception:
  UnknownHostException - If the hostname cannot be resolved.




receiveFile
public int receiveFile(String filename, int mode, OutputStream output, InetAddress host) throws IOException(Code)
Same as calling receiveFile(filename, mode, output, host, TFTP.DEFAULT_PORT).
Parameters:
  filename - The name of the file to receive.
Parameters:
  mode - The TFTP mode of the transfer (one of the MODE constants).
Parameters:
  output - The OutputStream to which the file should be written.
Parameters:
  host - The remote host serving the file.
exception:
  IOException - If an I/O error occurs. The nature of theerror will be reported in the message.



receiveFile
public int receiveFile(String filename, int mode, OutputStream output, String hostname) throws UnknownHostException, IOException(Code)
Same as calling receiveFile(filename, mode, output, hostname, TFTP.DEFAULT_PORT).
Parameters:
  filename - The name of the file to receive.
Parameters:
  mode - The TFTP mode of the transfer (one of the MODE constants).
Parameters:
  output - The OutputStream to which the file should be written.
Parameters:
  hostname - The name of the remote host serving the file.
exception:
  IOException - If an I/O error occurs. The nature of theerror will be reported in the message.
exception:
  UnknownHostException - If the hostname cannot be resolved.



sendFile
public void sendFile(String filename, int mode, InputStream input, InetAddress host, int port) throws IOException(Code)
Requests to send a file to a remote host, reads the file from an InputStream, sends the file to the remote host, and closes the connection. A local UDP socket must first be created by org.apache.commons.net.DatagramSocketClient.open open() before invoking this method. This method will not close the InputStream containing the file; you must close it after the method invocation.


Parameters:
  filename - The name the remote server should use when creatingthe file on its file system.
Parameters:
  mode - The TFTP mode of the transfer (one of the MODE constants).
Parameters:
  host - The remote host receiving the file.
Parameters:
  port - The port number of the remote TFTP server.
exception:
  IOException - If an I/O error occurs. The nature of theerror will be reported in the message.




sendFile
public void sendFile(String filename, int mode, InputStream input, String hostname, int port) throws UnknownHostException, IOException(Code)
Requests to send a file to a remote host, reads the file from an InputStream, sends the file to the remote host, and closes the connection. A local UDP socket must first be created by org.apache.commons.net.DatagramSocketClient.open open() before invoking this method. This method will not close the InputStream containing the file; you must close it after the method invocation.


Parameters:
  filename - The name the remote server should use when creatingthe file on its file system.
Parameters:
  mode - The TFTP mode of the transfer (one of the MODE constants).
Parameters:
  hostname - The name of the remote host receiving the file.
Parameters:
  port - The port number of the remote TFTP server.
exception:
  IOException - If an I/O error occurs. The nature of theerror will be reported in the message.
exception:
  UnknownHostException - If the hostname cannot be resolved.




sendFile
public void sendFile(String filename, int mode, InputStream input, InetAddress host) throws IOException(Code)
Same as calling sendFile(filename, mode, input, host, TFTP.DEFAULT_PORT).
Parameters:
  filename - The name the remote server should use when creatingthe file on its file system.
Parameters:
  mode - The TFTP mode of the transfer (one of the MODE constants).
Parameters:
  host - The name of the remote host receiving the file.
exception:
  IOException - If an I/O error occurs. The nature of theerror will be reported in the message.
exception:
  UnknownHostException - If the hostname cannot be resolved.



sendFile
public void sendFile(String filename, int mode, InputStream input, String hostname) throws UnknownHostException, IOException(Code)
Same as calling sendFile(filename, mode, input, hostname, TFTP.DEFAULT_PORT).
Parameters:
  filename - The name the remote server should use when creatingthe file on its file system.
Parameters:
  mode - The TFTP mode of the transfer (one of the MODE constants).
Parameters:
  hostname - The name of the remote host receiving the file.
exception:
  IOException - If an I/O error occurs. The nature of theerror will be reported in the message.
exception:
  UnknownHostException - If the hostname cannot be resolved.



setMaxTimeouts
public void setMaxTimeouts(int numTimeouts)(Code)
Sets the maximum number of times a receive attempt is allowed to timeout during a receiveFile() or sendFile() operation before ending attempts to retry the receive and failing. The default is DEFAULT_MAX_TIMEOUTS.


Parameters:
  numTimeouts - The maximum number of timeouts to allow. Valuesless than 1 should not be used, but if they are, they aretreated as 1.




Fields inherited from org.apache.commons.net.tftp.TFTP
final public static int ASCII_MODE(Code)(Java Doc)
final public static int BINARY_MODE(Code)(Java Doc)
final public static int DEFAULT_PORT(Code)(Java Doc)
final public static int DEFAULT_TIMEOUT(Code)(Java Doc)
final public static int IMAGE_MODE(Code)(Java Doc)
final public static int NETASCII_MODE(Code)(Java Doc)
final public static int OCTET_MODE(Code)(Java Doc)
final static int PACKET_SIZE(Code)(Java Doc)
byte[] _sendBuffer(Code)(Java Doc)

Methods inherited from org.apache.commons.net.tftp.TFTP
final public void beginBufferedOps()(Code)(Java Doc)
final public TFTPPacket bufferedReceive() throws IOException, InterruptedIOException, SocketException, TFTPPacketException(Code)(Java Doc)
final public void bufferedSend(TFTPPacket packet) throws IOException(Code)(Java Doc)
final public void discardPackets() throws IOException(Code)(Java Doc)
final public void endBufferedOps()(Code)(Java Doc)
final public static String getModeName(int mode)(Code)(Java Doc)
final public TFTPPacket receive() throws IOException, InterruptedIOException, SocketException, TFTPPacketException(Code)(Java Doc)
final public void send(TFTPPacket packet) throws IOException(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.