Package snap.util

Class URLUtils

java.lang.Object
snap.util.URLUtils

public class URLUtils extends Object
Utilities for URL.
  • Constructor Details

    • URLUtils

      public URLUtils()
  • Method Details

    • getURI

      public static URI getURI(URL aURL)
      Returns a URL for given string.
    • getString

      public static String getString(URL aURL)
      Returns the URL string for given object.
    • getRedirectString

      public static String getRedirectString(String aURLString)
      Returns a redirect string.
    • openURL

      public static void openURL(String aURL)
      Tries to open the given URL with the platform reader.
    • getBytes

      public static byte[] getBytes(URL aURL) throws IOException
      Returns bytes for url.
      Throws:
      IOException
    • getLastModTime

      public static long getLastModTime(URL aURL)
      Returns the last modified time of a URL.
    • isLocal

      public static boolean isLocal(URL aURL)
      Returns whether a URL is local.
    • getFile

      public static File getFile(URL aURL)
      Returns the URL as a file.
    • getLocalFile

      public static File getLocalFile(URL aURL) throws IOException
      Returns the given URL as a file (downloading to temp dir, if necessary).
      Throws:
      IOException
    • getLocalFile

      public static File getLocalFile(URL aURL, File aFile) throws IOException
      Returns the given URL as given file by downloading it.
      Throws:
      IOException
    • getLocalFileDestination

      public static File getLocalFileDestination(URL aURL, File aFile)
      Returns the destination file that the given URL would be saved to using the getLocalFile method.
    • primeNetworkConnection

      public static void primeNetworkConnection()
      Prime network connections: Java desktop seems to take a second+ to do first URL fetch.