|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.LatestURL
public class LatestURL
A class that reads a remote directory from an URL and returns the latest file
reference that fits the filter. For single acces, one can use the statis
last(java.net.URL) methods, for repetetive access, it is advisable to construct a
new object and call the update() method.
| Nested Class Summary | |
|---|---|
static class |
LatestURL.Dump
Dump an url-content to system-out. |
protected static class |
LatestURL.URLTime
A class that enhances an url for the modification time. |
| Field Summary | |
|---|---|
private FileFilter |
accept
The file filter. |
private URL |
base
The base URL. |
private Collection<URL> |
cache
The collection of all refences matching the filter retrieved lately. |
private LatestURL.URLTime |
latest
The youngest URL from the current cache. |
| Constructor Summary | |
|---|---|
LatestURL(URL dir)
Constructs an new latest url object. |
|
LatestURL(URL dir,
FileFilter filter)
Constructs an new latest url object. |
|
| Method Summary | |
|---|---|
protected LatestURL.URLTime |
deduceYoungest(Collection<URL> cc)
The base class only uses the modification time of the url. |
private static Set<URL> |
getFilteredReferences(URL dir,
FileFilter pass)
Returns all references from the base url in a set. |
URL |
getLatest()
Returns the last url-reference strored in the latest field. |
protected static long |
getModificationTime(URL ref)
Opens a connection to the specified URL and returns the time-stamp of the modification time. |
private static LatestURL.URLTime |
getYoungest(Collection<URL> filtered)
Takes a collection of filtered references and returns the newest one. |
void |
init()
This stupid splitting is just becaus super must always be first. |
static URL |
last(URL dir)
Retrieves all references, passes them through the filter and returns the url with the most actual date from the remaining list. |
static URL |
last(URL dir,
FileFilter pass)
Retrieves all references, passes them through the filter and returns the url with the most actual date from the remaining list. |
String |
toString()
Returns the string representation of the latest url. |
URL |
update()
Updates the reference cache and checks if we have to re-do evaluation of the youngest neighbour. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private URL base
private FileFilter accept
private Collection<URL> cache
private LatestURL.URLTime latest
| Constructor Detail |
|---|
public LatestURL(URL dir)
update() first check, if new references had been added to or
removed from the base url and acts only on the changes.
public LatestURL(URL dir,
FileFilter filter)
update() first check, if new references had been added to or
removed from the base url and acts only on the changes.
| Method Detail |
|---|
public void init()
init in interface Initializablepublic static URL last(URL dir)
public URL update()
public URL getLatest()
public String toString()
toString in class Object
public static URL last(URL dir,
FileFilter pass)
private static Set<URL> getFilteredReferences(URL dir,
FileFilter pass)
protected LatestURL.URLTime deduceYoungest(Collection<URL> cc)
private static LatestURL.URLTime getYoungest(Collection<URL> filtered)
protected static long getModificationTime(URL ref)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||