| org.apache.commons.net.tftp.TFTP org.apache.commons.net.tftp.TFTPClient
Field Summary | |
final public static int | DEFAULT_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 int | getMaxTimeouts() Returns the maximum number of times a receive attempt is allowed to
timeout before ending attempts to retry the receive and failing. | public int | receiveFile(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 int | receiveFile(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 int | receiveFile(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 int | receiveFile(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 void | sendFile(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 void | sendFile(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 void | sendFile(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 void | sendFile(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 void | setMaxTimeouts(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. |
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.
|
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.
|
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. |
|
|