+
+ /** 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); }