Methods Summary |
---|
public static void | main(java.lang.String[] av)Main program showing how to use it
switch(av.length) {
case 0:
ReadHeaders r = new ReadHeaders(
new BufferedReader(
new InputStreamReader(System.in)));
printit(r);
break;
default:
for (int i=0; i<av.length; i++)
try {
ReadHeaders rr = new ReadHeaders(
new BufferedReader(new FileReader(av[i])));
printit(rr);
} catch (FileNotFoundException e) {
System.err.println(e);
}
break;
}
|
public boolean | more()check to see if more headers available
if (is == null)
return false;
try {
inputLine = is.readLine();
if (inputLine == null || inputLine.length() == 0) {
is.close();
is = null;
}
} catch (IOException e) {
System.out.println("IOException: " + e);
is = null;
return false;
}
return true;
|
public Header | next()
int pos = inputLine.indexOf(":");
if (pos < 0)
return new Header("??", inputLine);
return new Header(
inputLine.substring(0, pos),
inputLine.substring(pos + 1));
|
public static void | printit(ReadHeaders r)Simple demo showing how to use it
while (r.more()) {
Header h = r.next();
System.out.println(h.type + " = " + h.text);
}
|