2003/09/24 07:33:32
[org.ibex.core.git] / src / org / xwt / XMLRPC.java
index c4f5fc6..12c6466 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2002 Adam Megacz, see the COPYING file for licensing [GPL]
+// Copyright 2003 Adam Megacz, see the COPYING file for licensing [GPL]
 package org.xwt;
 
 import java.io.*;
@@ -104,8 +104,8 @@ class XMLRPC extends JS.Callable {
                 objects.setElementAt(new Double(new String(content.getBuf(), 0, content.size())), objects.size() - 1);
             
             else if (c.localName.equals("base64"))
-                objects.setElementAt(new ByteStream(Base64.decode(new String(content.getBuf(), 0, content.size()))), objects.size() - 1);
-            
+                objects.setElementAt(new Res.ByteArray(Base64.decode(new String(content.getBuf(), 0, content.size()))), objects.size() - 1);
+
             else if (c.localName.equals("name"))
                 objects.addElement(new String(content.getBuf(), 0, content.size()));
             
@@ -196,10 +196,10 @@ class XMLRPC extends JS.Callable {
             sb.append(((Boolean)o).booleanValue() ? "1" : "0");
             sb.append("</boolean></value>\n");
 
-        } else if (o instanceof ByteStream) {
+        } else if (o instanceof Res) {
             try {
                 sb.append("                <value><base64>\n");
-                InputStream is = ((ByteStream)o).getInputStream();
+                InputStream is = ((Res)o).getInputStream();
                 byte[] buf = new byte[54];
                 while(true) {
                     int numread = is.read(buf, 0, 54);
@@ -243,7 +243,6 @@ class XMLRPC extends JS.Callable {
             /*
         } else if (o instanceof org.xwt.js.Date) {
             sb.append("                <value><dateTime.iso8601>");
-              FIXME
             org.xwt.js.Date d = (org.xwt.js.Date)o;
             Date d = new Date(nd.getRawTime());
             sb.append(d.getYear() + 1900);
@@ -308,7 +307,7 @@ class XMLRPC extends JS.Callable {
             while ((s = br2.readLine()) != null) Log.log(this, "send: " + s);
         }
 
-        HTTP.HTTPInputStream is = http.POST("text/xml", content);
+        InputStream is = http.POST("text/xml", content);
         try {
             BufferedReader br = !Log.verbose ?
                 new BufferedReader(new InputStreamReader(new Filter(is))) :
@@ -414,17 +413,17 @@ class XMLRPC extends JS.Callable {
         public Filter(InputStream is) { super(is); }
         public int read() throws IOException {
             java.lang.Thread.yield();
-            while(MessageQueue.nonThreadEventsInQueue > 0) try { java.lang.Thread.sleep(100); } catch (Exception e) { };
+            while(Message.Q.nonThreadEventsInQueue > 0) try { java.lang.Thread.sleep(100); } catch (Exception e) { };
             return super.read();
         }
         public int read(byte[] b) throws IOException {
             java.lang.Thread.yield();
-            while(MessageQueue.nonThreadEventsInQueue > 0) try { java.lang.Thread.sleep(100); } catch (Exception e) { };
+            while(Message.Q.nonThreadEventsInQueue > 0) try { java.lang.Thread.sleep(100); } catch (Exception e) { };
             return super.read(b);
         }
         public int read(byte[] b, int i, int j) throws IOException {
             java.lang.Thread.yield();
-            while(MessageQueue.nonThreadEventsInQueue > 0) try { java.lang.Thread.sleep(100); } catch (Exception e) { };
+            while(Message.Q.nonThreadEventsInQueue > 0) try { java.lang.Thread.sleep(100); } catch (Exception e) { };
             return super.read(b, i, j);
         }
     }