|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.erowid.sperowider.AHandler
Interface that all download handlers must implement
Constructor Summary | |
AHandler()
|
Method Summary | |
void |
addURLToModel(String sourceURL,
URL foundURL)
All requests to add URLs to the queue come through here, so we do the filtering and logging at this point. |
abstract void |
download(HttpURLConnection connection,
String fileName,
String originalURL)
This method is responsible for downloading the data at the passed in connection, and processing as appropriate (including, for example, spidering, adding it to the rectification queue, etc.) |
FileOutputStream |
getFileOutputStream(String fileName)
Returns an OutputStream to allow extending classes to write to the named file. |
String[] |
getReplaceableFilenameSuffixes()
This works with getRequiredFilenameSuffix() by providing a list of
suffixes that could simply be replaced with the value returned by
getRequiredFilenameSuffix() . |
String |
getRequiredFilenamePrefix()
Implementing classes can override this method to force files downloaded by this handler to start with a guaranteed prefix. |
String |
getRequiredFilenameSuffix()
Implementing classes can override this method to force files downloaded by this handler to end with a guaranteed suffix. |
SperowiderContext |
getSperowiderContext()
|
abstract void |
rectify(String filename)
This method is responsible for parsing the local file, and rewriting it as appropriate, typically replacing all URLs with relative local file references |
void |
setSperowiderContext(SperowiderContext sperowiderContext)
|
void |
stampFile(Writer writer,
URL url)
Writes an "originally found at" stamp into the passed in writer, which typically points to the downloaded file. |
String |
urlFoundInRectify(String sourceFileName,
String foundURL)
Called by descendant classes when they find a URL during rectifying. |
String |
urlFoundInSpider(URL sourceURL,
String foundURL)
Called by descendant classes when they find a URL during spidering. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AHandler()
Method Detail |
public abstract void download(HttpURLConnection connection, String fileName, String originalURL) throws IOException
IOException
public abstract void rectify(String filename) throws IOException
IOException
public void addURLToModel(String sourceURL, URL foundURL)
public FileOutputStream getFileOutputStream(String fileName) throws IOException
IOException
public SperowiderContext getSperowiderContext()
public void setSperowiderContext(SperowiderContext sperowiderContext)
sperowiderContext
- The sperowiderContext to set.public String getRequiredFilenamePrefix()
public String getRequiredFilenameSuffix()
public String[] getReplaceableFilenameSuffixes()
getRequiredFilenameSuffix()
by providing a list of
suffixes that could simply be replaced with the value returned by
getRequiredFilenameSuffix()
. So, for example, instead of simply
having ".html" always get appended, you could say "in the case of .shtml, .php,
.jsp, .asp, replace those with .html", for a more attractive file name.
public String urlFoundInSpider(URL sourceURL, String foundURL)
public String urlFoundInRectify(String sourceFileName, String foundURL)
public void stampFile(Writer writer, URL url) throws IOException
IOException
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |