ZipInputStream jstream=null;
Hashtable strmentries = null;
private void streamInit() {
- throw new Error("VamsasArchiveReader(Stream) Not implemented!");
- /* if (!stream) {
+ //throw new Error("VamsasArchiveReader(Stream) Not implemented!");
+ if (!stream) {
log.debug("Skipping init for Jar Stream input.");
return;
}
catch (Exception e) {
log.warn("Exceptions during init!",e);
jstream=null;
- }*/
+ }
}
public VamsasArchiveReader(File vamsasfile) {
*/
public VamsasArchiveReader(Lock vamsaslock) {
// LATER: implement or remove
- throw new Error("VamsasArchiveReading from locked IO stream not yet implemented.");
- //rfile = vamsaslock.rafile;
- //stream = true;
- //streamInit();
- //if (jstream==null)
- // throw new Error("Failed to open archive from Locked random access stream.");
+ if (vamsaslock==null || !vamsaslock.isLocked())
+ throw new Error("IMPLEMENTATION ERROR: Cannot create a VamsasArchiveReader without a valid lock.");
+ // throw new Error("VamsasArchiveReading from locked IO stream not yet implemented.");
+ try {
+ rfile = vamsaslock.getRaFile();
+ } catch (Exception e) {
+ log.warn("Unexpected IO Exception when accessing locked vamsas archive stream "+vamsaslock.target,e);
+ }
+ stream = true;
+ streamInit();
+ if (jstream==null)
+ throw new Error("Failed to open archive from Locked random access stream.");
}
/**
long epos = entrypos.longValue();
do {
entry = jstream.getNextEntry();
- } while (entry!=null && epos-->0);
+ } while (entry!=null && --epos>=0);
// rfile.seek(entrypos.longValue());
// make a Jar entry from a zip entry.
return new JarEntry(entry);