public class URLFileUpdater extends java.lang.Object implements FileUpdater
| Modifier and Type | Class and Description |
|---|---|
static class |
URLFileUpdater.Factory
Factory for constructing URLFileUpdater with basic settings
|
static interface |
URLFileUpdater.httpClientInteraction
Interface for interaction with HTTPClient api, or mock instance.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONTENT_TYPE |
static int |
DEFAULT_TIMEOUT |
static java.lang.String |
E_TAG |
static URLFileUpdater.Factory |
FACTORY |
static java.lang.String |
IF_MODIFIED_SINCE |
static java.lang.String |
IF_NONE_MATCH |
static java.lang.String |
LAST_MODIFIED |
| Constructor and Description |
|---|
URLFileUpdater(java.net.URL url,
java.lang.String acceptHeader,
int timeout,
java.io.File cacheMetadataFile,
java.io.File cachedContent,
boolean useCaching,
java.lang.String username,
java.lang.String password)
Create a URLUpdater
|
| Modifier and Type | Method and Description |
|---|---|
static URLFileUpdaterFactory |
factory() |
java.lang.String |
getContentType() |
java.lang.String |
getReasonCode() |
int |
getResultCode() |
void |
setInteraction(URLFileUpdater.httpClientInteraction interaction) |
void |
updateFile(java.io.File destinationFile)
Update the destination file.
|
public static final java.lang.String CONTENT_TYPE
public static final java.lang.String E_TAG
public static final java.lang.String IF_NONE_MATCH
public static final java.lang.String LAST_MODIFIED
public static final java.lang.String IF_MODIFIED_SINCE
public static final int DEFAULT_TIMEOUT
public static final URLFileUpdater.Factory FACTORY
public URLFileUpdater(java.net.URL url,
java.lang.String acceptHeader,
int timeout,
java.io.File cacheMetadataFile,
java.io.File cachedContent,
boolean useCaching,
java.lang.String username,
java.lang.String password)
url - the URLacceptHeader - contents of accept header, or nulltimeout - in seconds, -1 means use the default timeout, and 0 means no timeoutcacheMetadataFile - file to store cache metadatacachedContent - file containing previously cached contentuseCaching - true to use cachingusername - usernamepassword - passwordpublic void setInteraction(URLFileUpdater.httpClientInteraction interaction)
public static URLFileUpdaterFactory factory()
public void updateFile(java.io.File destinationFile)
throws FileUpdaterException
FileUpdaterupdateFile in interface FileUpdaterdestinationFile - the fileFileUpdaterException - on errorpublic java.lang.String getContentType()
public int getResultCode()
public java.lang.String getReasonCode()