X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2FStream.java;h=878afa33dc04b595482fa87b41e66cf8affa6f39;hb=da1f843588c8bd2b2c7cc74a5b4ffff8d57ab712;hp=ef63fe5563e41bce7080072c8f7ec44e0f04d1be;hpb=99d79f177824a7a75a19da16b08bdc016a2316b6;p=org.ibex.core.git diff --git a/src/org/ibex/Stream.java b/src/org/ibex/Stream.java index ef63fe5..878afa3 100644 --- a/src/org/ibex/Stream.java +++ b/src/org/ibex/Stream.java @@ -21,10 +21,10 @@ public abstract class Stream extends JS.Cloneable { public static class NotCacheableException extends Exception { } // streams are "sealed" by default to prevent accidental object leakage - public void put(Object key, Object val) throws JSExn { } + public void put(Object key, Object val) { } private Cache getCache = new Cache(100); - protected Object _get(Object key) throws JSExn { return null; } - public final Object get(Object key) throws JSExn { + protected Object _get(Object key) { return null; } + public final Object get(Object key) { Object ret = getCache.get(key); if (ret == null) getCache.put(key, ret = _get(key)); return ret; @@ -40,7 +40,7 @@ public abstract class Stream extends JS.Cloneable { private String url; public String toString() { return "Stream.HTTP:" + url; } HTTP(String url) { while (url.endsWith("/")) url = url.substring(0, url.length() - 1); this.url = url; } - public Object _get(Object key) throws JSExn { return new HTTP(url + "/" + (String)key); } + public Object _get(Object key) { return new HTTP(url + "/" + (String)key); } public String getCacheKey(Vec path) throws NotCacheableException { return url; } public InputStream getInputStream() throws IOException { return new org.ibex.HTTP(url).GET(); } } @@ -62,7 +62,7 @@ public abstract class Stream extends JS.Cloneable { public String toString() { return "file:" + path; } public String getCacheKey() throws NotCacheableException { throw new NotCacheableException(); /* already on disk */ } public InputStream getInputStream() throws IOException { return new FileInputStream(path); } - public Object _get(Object key) throws JSExn { return new File(path + java.io.File.separatorChar + (String)key); } + public Object _get(Object key) { return new File(path + java.io.File.separatorChar + (String)key); } } /** "unwrap" a Zip archive */ @@ -76,7 +76,7 @@ public abstract class Stream extends JS.Cloneable { this.path = path; } public String getCacheKey() throws NotCacheableException { return parent.getCacheKey() + "!zip:"; } - public Object _get(Object key) throws JSExn { return new Zip(parent, path==null?(String)key:path+'/'+(String)key); } + public Object _get(Object key) { return new Zip(parent, path==null?(String)key:path+'/'+(String)key); } public InputStream getInputStream() throws IOException { InputStream pis = parent.getInputStream(); ZipInputStream zis = new ZipInputStream(pis); @@ -94,7 +94,7 @@ public abstract class Stream extends JS.Cloneable { Cab(Stream parent) { this(parent, null); } Cab(Stream parent, String path) { this.parent = parent; this.path = path; } public String getCacheKey() throws NotCacheableException { return parent.getCacheKey() + "!cab:"; } - public Object _get(Object key) throws JSExn { return new Cab(parent, path==null?(String)key:path+'/'+(String)key); } + public Object _get(Object key) { return new Cab(parent, path==null?(String)key:path+'/'+(String)key); } public InputStream getInputStream() throws IOException { return new MSPack(parent.getInputStream()).getInputStream(path); } }