+ RandomAccessFile rfile;
+ ZipInputStream jstream=null;
+ Hashtable strmentries = null;
+ private void streamInit() {
+ if (!stream) {
+ log.debug("Skipping init for Jar Stream input.");
+ return;
+ }
+ strmentries = new Hashtable();
+ log.debug("Jar Stream input Initialisation");
+ try {
+ rfile.seek(0);
+ // no buffering - we need to be able to move around the random access stream.
+ jstream = new ZipInputStream(new FileInputStream(rfile.getFD())); // no manifest (probably)
+ if (jstream.available()==0)
+ log.warn("Can't read from JarInputStream (Locked stream!)");
+ ZipEntry entry=null;
+ do {
+ long pos = rfile.getFilePointer();
+ if ((entry=jstream.getNextEntry())!=null) {
+ if (strmentries.containsKey(entry.getName())) {
+ log.info("Only recording last of duplicate entries '"+entry.getName()+"'");
+ }
+ strmentries.put(entry.getName(), new Long(pos));
+ jstream.closeEntry();
+ }
+ } while (entry!=null);
+ }
+ catch (Exception e) {
+ log.warn("Exceptions during init!",e);
+ jstream=null;
+ }
+ }
+