public class Extractor
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
static java.util.ArrayList<java.lang.String> |
html |
Store contents of the html file
|
static java.util.ArrayList<java.lang.String> |
links |
Store links found in html file
|
Constructor | Description |
---|---|
Extractor() |
Modifier and Type | Method | Description |
---|---|---|
static void |
extractHtml() |
Extracts web links.
|
static void |
main(java.lang.String[] args) |
|
static void |
readHtml(java.lang.String url) |
Reads the contents of a specified web page into an
ArrayList of Strings. |
static void |
writeHtml(java.lang.String filename) |
Writes an HTML file containing a bulleted list of the links extracted from the original page.
|
public static java.util.ArrayList<java.lang.String> html
public static java.util.ArrayList<java.lang.String> links
public static void main(java.lang.String[] args)
public static void readHtml(java.lang.String url)
ArrayList
of Strings.url
- the address of the webpage to read frompublic static void extractHtml()
Each link is extracted from the HTML is stored in another ArrayList
.
The ".html" extension is removed before adding the link.
public static void writeHtml(java.lang.String filename)
filename
- name of output file