Class FTPCache
java.lang.Object
org.deltava.util.ftp.FTPCache
A utility class to provide cached access to a remote FTP server.
- Since:
- 1.0
- Version:
- 11.1
- Author:
- Luke
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns data about the last file downloaded.Checks the cache for a file, and downloads a new copy if not found or the remote copy is newer.getNewest
(String dirName, FilenameFilter filter) Returns the newest file on the remote server.void
setCredentials
(String user, String pwd) Sets the credentials used to connect to the remote FTP server.void
Sets the host name of the remote FTP server.
-
Constructor Details
-
FTPCache
Initializes the FTP cache bean.- Parameters:
path
- the local cache directory
-
-
Method Details
-
setHost
Sets the host name of the remote FTP server.- Parameters:
host
- the FTP server host name
-
setCredentials
-
getDownloadInfo
Returns data about the last file downloaded.- Returns:
- an FTPDownloadData bean, or null if no file downloaded
-
getNewest
Returns the newest file on the remote server.- Parameters:
dirName
- the directory on the serverfilter
- a FilenameFilter or null if none- Returns:
- the file name, or null if no files found
- See Also:
-
getFile
Checks the cache for a file, and downloads a new copy if not found or the remote copy is newer.- Parameters:
fileName
- the file name- Returns:
- an InputStream to the file data
- Throws:
FTPClientException
- if an error occurs
-