Class NetUtils

java.lang.Object
ubic.gemma.core.util.NetUtils

public class NetUtils extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    bytePerSecondToDisplaySize(double bytesPerSecond)
     
    static long
    checkForFile(org.apache.commons.net.ftp.FTPClient f, String seekFile)
    Determine if a file exists on the remote server.
    static org.apache.commons.net.ftp.FTPClient
    connect(int mode, String host, String loginName, String password)
    Convenience method to get an FTP connection.
    static boolean
    ftpDownloadFile(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 boolean
    ftpDownloadFile(org.apache.commons.net.ftp.FTPClient f, String seekFile, String outputFileName, boolean force)
    Download a file via FTP to the given local path.
    static long
    ftpFileSize(org.apache.commons.net.ftp.FTPClient f, String seekFile)
    Get the size of a remote file.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NetUtils

      public NetUtils()
  • Method Details

    • bytePerSecondToDisplaySize

      public static String bytePerSecondToDisplaySize(double bytesPerSecond)
    • 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:
      SocketException
      IOException
    • 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