|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.claudio.pediacache.data.CachedPage
public class CachedPage
Contains a cahcede page or the request for a page to fetch.
Note: hasCode and equals considers only url.
Copyright (C) 2006 Claudio Nieder <private@claudio.ch>, CH-8610 Uster
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Constructor Summary | |
---|---|
CachedPage(java.net.URL urlArg,
byte[] contentArg,
java.lang.String contentTypeArg,
Source sourceArg)
A page needs the URL and its content with meta information. |
|
CachedPage(java.net.URL urlArg,
Source sourceArg,
int priorityArg)
A page needs the URL and its content with meta information. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
|
static java.lang.String |
extractCharset(java.lang.String contentType)
Determine the charset given a content type |
java.lang.String |
getCharset()
Return the charset part of the content type. |
byte[] |
getContent()
|
java.lang.String |
getContentAsString()
Convert content into a string using the specified charset. |
java.lang.String |
getContentType()
|
long |
getLastFetchTime()
|
long |
getLastReadTime()
|
int |
getPriority()
|
java.net.URL |
getRedirected()
|
Source |
getSource()
|
java.net.URL |
getUrl()
|
java.lang.String |
getUrlAsString()
|
int |
hashCode()
|
boolean |
hasPriority(int priorityArg)
Tells if the page has requested priority |
boolean |
hasURL(java.lang.String urlArg)
Tells the url of this page matches given url |
boolean |
isFetched()
Tells if the page is not just queued but actually fetched and cached |
boolean |
isHTML()
Tells if is it an html page |
boolean |
isNewer(long limit)
Tells if the was read since the specified time |
boolean |
isNotFetched()
Tells if the page is not just queued but actually fetched and cached |
boolean |
isRedirected()
Tells if the page is a redirection to another locateion |
static void |
main(java.lang.String[] args)
Print license. |
void |
refreshFetchTime()
Update the time with the current time. |
void |
refreshReadTime()
Update the time with the current time. |
void |
setContent(byte[] contentArg,
java.lang.String contentTypeArg)
Change the content of this cache item. |
void |
setPriority(int priorityArg)
Set the priority |
void |
setRedirected(java.net.URL newURL)
Sets a redirection to another URL which contains the page. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CachedPage(java.net.URL urlArg, byte[] contentArg, java.lang.String contentTypeArg, Source sourceArg)
urlArg
- url of pagecontentArg
- contant as byte arraycontentTypeArg
- type as reported by Content-Type headersourceArg
- wikipedia sitepublic CachedPage(java.net.URL urlArg, Source sourceArg, int priorityArg)
urlArg
- url of pagesourceArg
- Source for the urlpriorityArg
- fetching priority of queued pageMethod Detail |
---|
public void setContent(byte[] contentArg, java.lang.String contentTypeArg)
contentArg
- contant as byte arraycontentTypeArg
- type as reported by Content-Type headerpublic void setRedirected(java.net.URL newURL)
newURL
- url as supplied from web serverpublic boolean isRedirected()
public java.net.URL getRedirected()
public void refreshFetchTime()
public void refreshReadTime()
public byte[] getContent()
public static java.lang.String extractCharset(java.lang.String contentType)
contentType
-
public java.lang.String getCharset()
public java.lang.String getContentAsString()
This form of the content is useful for text which is parsed of modified but should not be used on other content like images.
public java.net.URL getUrl()
public java.lang.String getUrlAsString()
public java.lang.String getContentType()
public long getLastFetchTime()
public long getLastReadTime()
public int getPriority()
public boolean hasURL(java.lang.String urlArg)
urlArg
- to compare
public boolean isHTML()
public boolean isNewer(long limit)
limit
-
public boolean isFetched()
public boolean isNotFetched()
public boolean hasPriority(int priorityArg)
priorityArg
-
public void setPriority(int priorityArg)
priorityArg
- public Source getSource()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public static void main(java.lang.String[] args)
args
- ignored
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |