import sun.net.www.HeaderParser; import java.io.*; public class HeaderParserTest { public static void main(String[] args) { for (int i = 0; i < args.length; i++) { StringBuffer buffer = new StringBuffer(); try { FileInputStream fis = new FileInputStream(args[i]); DataInputStream dis = new DataInputStream(fis); String theLine; while ((theLine = dis.readLine()) != null) { buffer.append(theLine + "\r\n"); } HeaderParser hp = new HeaderParser(buffer.toString()); for (int j = 0; ; j++) { String key = hp.findKey(j); if (key == null) break; System.out.println(key + ": " + hp.findValue(j)); } } catch (IOException e) { System.err.println(e); } } } }