|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.erowid.sperowider.ASpiderBase
Downloads files to the local drive.
Field Summary | |
static int |
ALREADY_GRABBED
Returned by spider(String) to indicate that the download was
not done because this file was downloaded under another name. |
static int |
BAD_HTTP_RESPONSE
Returned by spider(String) to indicate that the download failed
because of an HTTP error (a 404, for example). |
static int |
EXCEPTION
Returned by spider(String) to indicate that the download failed
because of a thrown exception. |
static int |
FILTER_FAILURE
Returned by spider(String) to indicate that the download was not
done because it was blocked by a filter (either robots.txt or the Sperowider
filter itself). |
static String |
SPEROWIDER_USER_AGENT
The actual user agent sent to websites : "Sperowider/1.1" |
static String |
SPEROWIDER_USER_AGENT_NAME
The name of the user agent, without the version number : "Sperowider" |
static String |
SPEROWIDER_USER_AGENT_VERSION
The current version number of the Sperowider : "1.1" |
static int |
SUCCESS
Returned by spider(String) to indicate that the download succeeded. |
Constructor Summary | |
ASpiderBase()
Instantiates a spider base with a non-throttle. |
|
ASpiderBase(IThrottle throttle)
Instantiates a spider base, with a given throttle. |
Method Summary | |
int |
getDownloadStatisticCount(int downloadStatus)
Returns the number of downloads that have resulted in the passed in status. |
int |
getHttpResponseCodeCount(int httpResponseCode)
Returns the number of Http responses of each kind. |
int |
getTotalDownloadAttempts()
Returns the total number of download attempts. |
int |
getTotalHttpAttempts()
Returns the total number of download attempts. |
abstract int |
handleConnection(String sourceUrl,
HttpURLConnection connection)
When a connection is actually established, this method will be called. |
abstract void |
handleConnectionException(String sourceUrl,
Throwable e)
This is called by spider(String) when an exception is found
when an attempt to load the URL is hit. |
int |
spider(String url)
Downloads and spiders the passed in URL. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String SPEROWIDER_USER_AGENT_NAME
public static final String SPEROWIDER_USER_AGENT_VERSION
public static final String SPEROWIDER_USER_AGENT
public static final int SUCCESS
spider(String)
to indicate that the download succeeded.
public static final int FILTER_FAILURE
spider(String)
to indicate that the download was not
done because it was blocked by a filter (either robots.txt or the Sperowider
filter itself).
public static final int EXCEPTION
spider(String)
to indicate that the download failed
because of a thrown exception.
public static final int BAD_HTTP_RESPONSE
spider(String)
to indicate that the download failed
because of an HTTP error (a 404, for example).
public static final int ALREADY_GRABBED
spider(String)
to indicate that the download was
not done because this file was downloaded under another name.
Constructor Detail |
public ASpiderBase(IThrottle throttle)
public ASpiderBase()
Method Detail |
public abstract int handleConnection(String sourceUrl, HttpURLConnection connection)
public abstract void handleConnectionException(String sourceUrl, Throwable e)
spider(String)
when an exception is found
when an attempt to load the URL is hit.
public int spider(String url)
public int getDownloadStatisticCount(int downloadStatus)
SUCCESS
, ALREADY_GRABBED
,
BAD_HTTP_RESPONSE
, EXCEPTION
, FILTER_FAILURE
,
SUCCESS
.
public int getHttpResponseCodeCount(int httpResponseCode)
public int getTotalHttpAttempts()
getTotalDownloadAttempts()
, because this counts
each 302 as an Http attempt.
public int getTotalDownloadAttempts()
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |