2003/11/03 05:28:32
[org.ibex.core.git] / src / org / xwt / Platform.java
index 5b1f0ac..f8937ca 100644 (file)
@@ -317,6 +317,25 @@ public class Platform {
 
         return cachedProxyInfo;
     }
+
+    /** returns a Scheduler instance; used to implement platform-specific schedulers */
+    protected Scheduler _getScheduler() { return new Scheduler(); }
+    public static Scheduler getScheduler() { return platform._getScheduler(); }
+    
+    /** read an input stream into a byte array and invoke callback when ready */
+    protected void _inputStreamToByteArray(final InputStream is, final Callback c) {
+        new java.lang.Thread() {
+            public void run() {
+                try {
+                    final byte[] b = InputStreamToByteArray.convert(is);
+                    Scheduler.add(new Scheduler.Task() { public void perform() { c.call(b); }});
+                } catch (IOException e) {
+                    Log.log(Platform.class, e);
+                }
+            }
+        }.start();    
+    }
+    public static void inputStreamToByteArray(InputStream is, Callback c) { platform._inputStreamToByteArray(is, c); }
     
     public static void running() { platform._running(); }
     public void _running() { new Semaphore().block(); }