Posted By:
Luigi_Viggiano
Posted On:
Saturday, June 30, 2001 05:57 AM
I can give you the way to access jar resources as URL; to display the retrieved html in your JavaBrowser will be another issue.
check this code:
import java.net.*;
import java.io.*;
public class JarTest {
URL getJarFileURL(String jarFile, String fileName)
throws MalformedURLException {
return new URL("jar:file:" + jarFile + "!/" + fileName);
}
void printInputStream(InputStream is) throws IOException {
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
while (br.ready()) {
System.out.println(br.readLine());
}
br.close();
}
public void displayInMyBroser(URL url) {
// MyJavaBrowser mjb = new MyJavaBrowser();
// mjb.showURL(url);
}
public void displayJarFile(String jarFile, String fileName)
throws MalformedURLException, IOException {
URL u = getJarFileURL(jarFile, fileName);
printInputStream(u.openStream());
// displayInMyBrowser(u);
}
public static void main(String[] args) throws Exception {
String jarFile = "D:/JBuilder4/doc/langspec.jar";
String fileName = "java/langspec/intro.doc.html";
new JarTest().displayJarFile(jarFile, fileName);
}
}