Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.owasp.dependencycheck.utils
Class Downloader

    java.lang.Object
      org.owasp.dependencycheck.utils.Downloader

    public final class Downloader

extends Object

A utility to download files from the Internet.

Author:
  Jeremy Long (jeremy.long@owasp.org)

Method Summary
`static void` | `fetchFile(URL url, File outputPath)` Retrieves a file from a given URL and saves it to the outputPath.
`static long` | `getLastModified(URL url)` Makes an HTTP Head request to retrieve the last modified date of the given URL.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### fetchFile

    public static void fetchFile(URL url,
                                 File outputPath)
                          throws DownloadFailedException

  Retrieves a file from a given URL and saves it to the outputPath.

  Parameters:
    `url` - the URL of the file to download.
    `outputPath` - the path to the save the file to.
  Throws:
    `DownloadFailedException` - is thrown if there is an error downloading the file.

### getLastModified

    public static long getLastModified(URL url)
                                throws DownloadFailedException

  Makes an HTTP Head request to retrieve the last modified date of the given URL. If the file:// protocol is specified, then the lastTimestamp of the file is returned.

  Parameters:
    `url` - the URL to retrieve the timestamp from
  Returns:
    an epoch timestamp
  Throws:
    `DownloadFailedException` - is thrown if an exception occurs making the HTTP request

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012-2013 OWASP. All Rights Reserved.