[re]-merged in Brians stuff
[org.ibex.core.git] / src / org / ibex / core / Stream.java
index 40fc71f..24f96c4 100644 (file)
@@ -1,10 +1,11 @@
 // Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL]
-package org.ibex.js;
+package org.ibex.core;
 
 import java.io.*;
 import java.util.zip.*;
+import org.ibex.js.*;
 import org.ibex.util.*;
-//import org.ibex.plat.*;
+import org.ibex.plat.*;
 import org.ibex.net.*;
 
 /**
@@ -13,7 +14,7 @@ import org.ibex.net.*;
  *   be totally independent of the others (ie separate stream position
  *   and state) although they draw from the same data source.
  */
-public abstract class Stream extends JS.Cloneable {
+public abstract class Stream extends JS.O implements JS.Cloneable {
 
     // Public Interface //////////////////////////////////////////////////////////////////////////////
 
@@ -38,11 +39,11 @@ public abstract class Stream extends JS.Cloneable {
     /** HTTP or HTTPS resource */
     public static class HTTP extends Stream {
         private String url;
-        public String toString() { return "Stream.HTTP:" + url; }
+        //public String toString() { return "Stream.HTTP:" + url; }
         public HTTP(String url) { while (url.endsWith("/")) url = url.substring(0, url.length() - 1); this.url = url; }
         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.net.HTTP(url).GET(); }
+        public InputStream getInputStream() throws IOException { return new org.ibex.net.HTTP(url).GET(null, null); }
     }
 
     /** byte arrays */
@@ -59,7 +60,7 @@ public abstract class Stream extends JS.Cloneable {
     public static class File extends Stream {
         private String path;
         public File(String path) { this.path = path; }
-        public String toString() { return "file:" + path; }
+        //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) { return new File(path + java.io.File.separatorChar + (String)key); }
@@ -88,6 +89,7 @@ public abstract class Stream extends JS.Cloneable {
     }
 
     /** "unwrap" a Cab archive */
+    /*
     public static class Cab extends Stream {
         private Stream parent;
         private String path;
@@ -97,6 +99,7 @@ public abstract class Stream extends JS.Cloneable {
         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); }
     }
+    */
 
     /** the Builtin resource */
     public static class Builtin extends Stream {