Methods Summary |
---|
private static boolean | findChar(java.io.InputStreamReader page, char targetChar)Find the next given char in an HTML page move past it.
int currentChar;
currentChar = page.read();
while (Character.toLowerCase((char)currentChar) != targetChar) {
if (currentChar == -1) {
return false;
}
currentChar = page.read();
}
return true;
|
private static boolean | findString(java.io.InputStreamReader page, java.lang.String targetString)Find the next given string in an HTML page move past it.
for (int i = 0; i < targetString.length(); i++) {
if (!findChar(page, targetString.charAt(i))) {
return false;
}
}
return true;
|
static java.util.Vector | getDownloadInfoFromPage(java.io.InputStreamReader page)Read a HTML page and pickout the links for MIDlet suites.
A MIDlet suite links end with .jad
Vector suites = new Vector();
SuiteDownloadInfo info;
info = getNextJadLink(page);
while (info != null) {
if (info.url.endsWith(".jad") ||
info.url.endsWith(".jar")) {
suites.addElement(info);
}
info = getNextJadLink(page);
}
return suites;
|
private static com.sun.midp.installer.SuiteDownloadInfo | getNextJadLink(java.io.InputStreamReader page)Read a HTML page and pickout next link.
String url;
String label;
url = getNextUrl(page);
if (url == null) {
return null;
}
label = getNextLabel(page);
if (label == null) {
label = url;
}
return new SuiteDownloadInfo(url, label);
|
private static java.lang.String | getNextLabel(java.io.InputStreamReader page)Read a HTML page and pickout the text after the beginning anchor.
int currentChar;
StringBuffer label;
if (!findChar(page, '>")) {
return null;
}
label = new StringBuffer();
currentChar = page.read();
while (currentChar != '<") {
if (currentChar == -1) {
return null;
}
label.append((char)currentChar);
currentChar = page.read();
}
if (label.length() == 0) {
return null;
}
return label.toString();
|
private static java.lang.String | getNextUrl(java.io.InputStreamReader page)Read a HTML page and pickout next href.
int currentChar;
StringBuffer url;
if (!findString(page, "href=\"")) {
return null;
}
url = new StringBuffer();
currentChar = page.read();
while (currentChar != '"") {
if (currentChar == -1) {
return null;
}
url.append((char)currentChar);
currentChar = page.read();
}
if (url.length() == 0) {
return null;
}
return url.toString();
|