BufferedReader is = new BufferedReader(new FileReader(INPUT_NAME));
PrintWriter pub = new PrintWriter(new FileWriter(PUBLIC_NAME));
PrintWriter logged = new PrintWriter(new FileWriter(LOGGEDIN_NAME));
// PrintWriter teaser = new PrintWriter(new FileWriter(TEASER_NAME));
String line;
while ((line = is.readLine()) != null) {
// Login:P:login.jsp
// Search:L:search.jsp
if (line.startsWith("#")) { // comment
continue;
}
StringTokenizer st = new StringTokenizer(line, ":");
String name = st.nextToken();
String perm = st.nextToken();
String url = st.nextToken();
// if P-only
if (perm.indexOf('P")!=-1 && perm.indexOf('L")==-1) {
mkLink(pub, url, name);
} else
// if L and P
if (perm.indexOf('L")!=-1 && perm.indexOf('P")!=-1) {
mkLink(pub, url, name);
mkLink(logged, url, name);
} else
// if L and !P
if (perm.indexOf('L")!=-1 && perm.indexOf('P")==-1) {
mkLink(logged, url, name);
pub.print("<li><i id=\"LinkLocal\">");
pub.print(name);
pub.println("</i>");
} else if (perm.equals("E")) { // Editorial
// ignore for now
}
else if (perm.equals("A")) { // Administration
// ignore for now
}
else {
System.err.println("WARNING: line " + line +
"--> has invalid permission tag " + perm);
}
}
pub.close();
logged.close();
// teaser.close();