Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JarURLConnection from an applet, anyone tried?

 
raimondas zemaitis
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone tried to use JarURLConnection class to get resources
from the server ?
I am trying to use but this piece of code gives exception in the
browser (with appletviewer works perfectly)
URL url = new URL(getDocumentBase(), "restImages.jar!/");
url = new URL("jar:" + url.toString());
JarURLConnection jar = (JarURLConnection)url.openConnection();
JarFile jarFile = jar.getJarFile();
InputStream iStream = getClass().getResourceAsStream("restImages.dat");
^^^^^^^^^I get iStream == null
BufferedInputStream bStream =
new BufferedInputStream(iStream);
ObjectInputStream oStream = new ObjectInputStream(bStream);
restImages = (int[][][])oStream.readObject();
What I want to do is to load the rest of images in the applet in the background with separate thread while first portion from
<ARCHIVE=some.jar> is being processed. JAR file being loaded here
contains file restImages.dat with images already pre-processed
[This message has been edited by raimondas zemaitis (edited February 23, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic