Package ubic.basecode.util
Class NetUtils
java.lang.Object
ubic.basecode.util.NetUtils
- Author:
- pavlidis
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longcheckForFile(org.apache.commons.net.ftp.FTPClient f, String seekFile) determine if a file exists on the remote server.static org.apache.commons.net.ftp.FTPClientConvenient method to get a FTP connection.static booleanftpDownloadFile(org.apache.commons.net.ftp.FTPClient f, String seekFile, File outputFile, boolean force) static booleanftpDownloadFile(org.apache.commons.net.ftp.FTPClient f, String seekFile, String outputFileName, boolean force) static longftpFileSize(org.apache.commons.net.ftp.FTPClient f, String seekFile) Get the size of a remote file.
-
Constructor Details
-
NetUtils
public NetUtils()
-
-
Method Details
-
checkForFile
public static long checkForFile(org.apache.commons.net.ftp.FTPClient f, String seekFile) throws IOException determine if a file exists on the remote server.- Parameters:
f-seekFile-- Returns:
- the size of the file
- Throws:
FileNotFoundException- if the file does not exist.IOException- on other IO errors.
-
connect
public static org.apache.commons.net.ftp.FTPClient connect(int mode, String host, String loginName, String password) throws SocketException, IOException Convenient method to get a FTP connection.- Parameters:
mode-host-password-login-- Returns:
- Throws:
SocketExceptionIOException
-
ftpDownloadFile
public static boolean ftpDownloadFile(org.apache.commons.net.ftp.FTPClient f, String seekFile, File outputFile, boolean force) throws IOException - Parameters:
f-seekFile-outputFile-force-- Returns:
- boolean indicating success or failure.
- Throws:
IOException
-
ftpDownloadFile
public static boolean ftpDownloadFile(org.apache.commons.net.ftp.FTPClient f, String seekFile, String outputFileName, boolean force) throws IOException, FileNotFoundException - Parameters:
f-seekFile-outputFileName-force-- Returns:
- boolean indicating success or failure.
- Throws:
IOExceptionFileNotFoundException
-
ftpFileSize
public static long ftpFileSize(org.apache.commons.net.ftp.FTPClient f, String seekFile) throws IOException Get the size of a remote file.- Parameters:
f- FTPClientseekFile-- Returns:
- Throws:
IOException
-