Class HTMLpage

java.lang.Object
   |
   +----HTMLpage

public class HTMLpage
extends Object
HTMLpage class store one page pointed by one single URL, it contains a linked list of hyperlinks inside the page As of now, only 3 type of tags: A HREF, backgroudimage, img can be recognized


Constructor Index

 o HTMLpage(String)
create a HTMLpage object given a single url

Method Index

 o analysis()
find out all the link inside that page
 o download()
start to download the content from the URL
 o getDocumentBase()
return the directory the file is located in the ORIGINAL URL for the use of directory reorder
 o getFilename(String)
return a usable local file name
 o getURL()
return the URL of this page
 o isImage(String)
static utilily function to test if a given URL is a image or not
 o save(DB, String)
save the content of page to a local direcotry, modify the link structure according to the content of DB

Constructors

 o HTMLpage
 public HTMLpage(String url)
create a HTMLpage object given a single url

Methods

 o isImage
 public static int isImage(String url)
static utilily function to test if a given URL is a image or not

Parameters:
url - the url
Returns:
1 if the url is pointing to a image, otherwise return 0
 o download
 public int download()
start to download the content from the URL

 o getDocumentBase
 public String getDocumentBase()
return the directory the file is located in the ORIGINAL URL for the use of directory reorder

 o getFilename
 public String getFilename(String fullname)
return a usable local file name

Parameters:
fullname - the original filename (including path) in the URL
Returns:
a local filename
 o getURL
 public URL getURL()
return the URL of this page

 o save
 public boolean save(DB dbref,
                     String dir)
save the content of page to a local direcotry, modify the link structure according to the content of DB

Parameters:
dbref - the database object, used to decide a link is remote or local
dir - the local directory the file will be saved to
Returns:
ture if the save operation is successful
 o analysis
 public Vector analysis()
find out all the link inside that page