Class NetUtils
java.lang.Object
ubic.gemma.core.util.NetUtils
Network / transfer-rate helpers.
The FTP helpers (checkForFile(FTPClient, String), connect(int, String, String, String), ftpDownloadFile(FTPClient, String, File, boolean),
ftpFileSize(FTPClient, String)) were ported in-tree from ubic.basecode.util.NetUtils
as part of the Phase 3 baseCode util retirement (see
BASECODE_DEP_AUDIT.md). They have been merged into the existing in-tree
NetUtils (which already housed bytePerSecondToDisplaySize(double)) rather
than living in a separate class — the audit hint and the call-site layout both
point at one network-utility home.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbytePerSecondToDisplaySize(double bytesPerSecond) static 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.FTPClientConvenience method to get an FTP connection.static booleanftpDownloadFile(org.apache.commons.net.ftp.FTPClient f, String seekFile, File outputFile, boolean force) Download a file via FTP, skipping if a complete local copy already exists.static booleanftpDownloadFile(org.apache.commons.net.ftp.FTPClient f, String seekFile, String outputFileName, boolean force) Download a file via FTP to the given local path.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
-
bytePerSecondToDisplaySize
-
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.- 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 Convenience method to get an FTP connection.- Throws:
SocketExceptionIOException
-
ftpDownloadFile
public static boolean ftpDownloadFile(org.apache.commons.net.ftp.FTPClient f, String seekFile, File outputFile, boolean force) throws IOException Download a file via FTP, skipping if a complete local copy already exists.- 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 Download a file via FTP to the given local path.- Returns:
- boolean indicating success or failure.
- Throws:
IOException
-
ftpFileSize
public static long ftpFileSize(org.apache.commons.net.ftp.FTPClient f, String seekFile) throws IOException Get the size of a remote file.- Throws:
IOException
-