public class URLChangeTracker extends Object
Modifier and Type | Field and Description |
---|---|
static ClasspathURLConverter |
DEFAULT_CONVERTER |
Constructor and Description |
---|
URLChangeTracker()
Creates a tracker using the default (does nothing) URL converter, with default (millisecond)
granularity and folder tracking disabled.
|
URLChangeTracker(ClasspathURLConverter classpathURLConverter)
Creates a new URL change tracker with millisecond-level granularity and folder checking enabled.
|
URLChangeTracker(ClasspathURLConverter classpathURLConverter,
boolean granularitySeconds)
Creates a new URL change tracker, using either millisecond-level granularity or second-level granularity and
folder checking enabled.
|
URLChangeTracker(ClasspathURLConverter classpathURLConverter,
boolean granularitySeconds,
boolean trackFolderChanges)
Creates a new URL change tracker, using either millisecond-level granularity or second-level granularity.
|
Modifier and Type | Method and Description |
---|---|
long |
add(URL url)
Stores a new URL into the tracker, or returns the previous time stamp for a previously added URL.
|
void |
clear()
Clears all URL and timestamp data stored in the tracker.
|
boolean |
containsChanges()
Re-acquires the last updated timestamp for each URL and returns true if any timestamp has changed.
|
void |
forceChange()
Needed for testing; changes file timestamps so that a change will be detected by
containsChanges() . |
static File |
toFileFromFileProtocolURL(URL url)
Converts a URL with protocol "file" to a File instance.
|
public static final ClasspathURLConverter DEFAULT_CONVERTER
public URLChangeTracker()
public URLChangeTracker(ClasspathURLConverter classpathURLConverter)
classpathURLConverter
- used to convert URLs from one protocol to anotherpublic URLChangeTracker(ClasspathURLConverter classpathURLConverter, boolean granularitySeconds)
classpathURLConverter
- used to convert URLs from one protocol to anothergranularitySeconds
- whether or not to use second granularity (as opposed to millisecond granularity)public URLChangeTracker(ClasspathURLConverter classpathURLConverter, boolean granularitySeconds, boolean trackFolderChanges)
classpathURLConverter
- used to convert URLs from one protocol to anothergranularitySeconds
- whether or not to use second granularity (as opposed to millisecond granularity)trackFolderChanges
- if true, then adding a file URL will also track the folder containing the file (this
is useful when concerned about additions to a folder)public static File toFileFromFileProtocolURL(URL url)
public long add(URL url)
url
- of the resource to add, or null if not knownpublic void clear()
public boolean containsChanges()
public void forceChange()
containsChanges()
.5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.