public class UpdateUtils
extends java.lang.Object
updateFileFromUrl(String, String)
to GET a file from remote URL and store it to a file.
This utility will provide locks and synchronization to prevent two threads or jvms from overwriting the destination
file at the same time, and will use last modification time from the source URL to skip URL acquisition based on file
modification time.Modifier and Type | Class and Description |
---|---|
static class |
UpdateUtils.UpdateException
An exception caused by the UpdateUtils methods.
|
Constructor and Description |
---|
UpdateUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
update(FileUpdater updater,
java.io.File destFile)
Update a destination file with an updater implementation, while maintaining appropriate
locks around the action and file
|
static void |
updateFileFromFile(java.io.File sourceFile,
java.lang.String destinationFilePath)
Get the source File and store it to a destination file path
|
static void |
updateFileFromInputStream(java.io.InputStream input,
java.lang.String destinationFilePath)
Get the source URL and store it to a destination file path
|
static void |
updateFileFromUrl(java.lang.String sourceUrl,
java.lang.String destinationFilePath)
Get the source URL and store it to a destination file path
|
static void |
updateFileFromUrl(java.lang.String sourceUrl,
java.lang.String destinationFilePath,
java.lang.String username,
java.lang.String password)
Get the source URL and store it to a destination file path
|
static void |
updateFileFromUrl(java.lang.String sourceUrl,
java.lang.String destinationFilePath,
java.lang.String username,
java.lang.String password,
URLFileUpdaterFactory factory)
Get the source URL and store it to a destination file path
|
public static void updateFileFromUrl(java.lang.String sourceUrl, java.lang.String destinationFilePath) throws UpdateUtils.UpdateException
sourceUrl
- urldestinationFilePath
- destinationUpdateUtils.UpdateException
- on errorpublic static void updateFileFromFile(java.io.File sourceFile, java.lang.String destinationFilePath) throws UpdateUtils.UpdateException
sourceFile
- sourcedestinationFilePath
- destinationUpdateUtils.UpdateException
- on errorpublic static void updateFileFromInputStream(java.io.InputStream input, java.lang.String destinationFilePath) throws UpdateUtils.UpdateException
input
- input streamdestinationFilePath
- destinationUpdateUtils.UpdateException
- on errorpublic static void updateFileFromUrl(java.lang.String sourceUrl, java.lang.String destinationFilePath, java.lang.String username, java.lang.String password) throws UpdateUtils.UpdateException
sourceUrl
- urldestinationFilePath
- destinationusername
- usernamepassword
- passwordUpdateUtils.UpdateException
- on errorpublic static void updateFileFromUrl(java.lang.String sourceUrl, java.lang.String destinationFilePath, java.lang.String username, java.lang.String password, URLFileUpdaterFactory factory) throws UpdateUtils.UpdateException
sourceUrl
- urldestinationFilePath
- destinationusername
- usernamepassword
- passwordfactory
- updater factoryUpdateUtils.UpdateException
- on errorpublic static void update(FileUpdater updater, java.io.File destFile) throws UpdateUtils.UpdateException
updater
- updaterdestFile
- destinationUpdateUtils.UpdateException
- on error