public String toString() { return "byte[]"; }
public String getCacheKey() throws NotCacheableException { return cacheKey; }
public InputStream getInputStream(String path) throws IOException {
- if (!"".equals(path)) throw new JSExn("can't get subresources of a byte[] resource");
+ if (!"".equals(path)) throw new IOException("can't get subresources of a byte[] resource");
return new ByteArrayInputStream(bytes);
}
}
ZipInputStream zis = new ZipInputStream(pis);
ZipEntry ze = zis.getNextEntry();
while(ze != null && !ze.getName().equals(path)) ze = zis.getNextEntry();
- if (ze == null) throw new JSExn("requested file (" + path + ") not found in archive");
+ if (ze == null) throw new IOException("requested file (" + path + ") not found in archive");
return new KnownLength.KnownLengthInputStream(zis, (int)ze.getSize());
}
}
public int read(byte[] b, int off, int len) throws IOException {
int ret = super.read(b, off, len);
if (ret != 1) bytesDownloaded += ret;
- Scheduler.add(new Scheduler.Task() { public void perform() {
+ Scheduler.add(new Scheduler.Task() { public void perform() throws Exception {
callback.call(N(bytesDownloaded),
N(is instanceof KnownLength ? ((KnownLength)is).getLength() : 0), null, null, 2);
} });