aboutsummaryrefslogtreecommitdiff
path: root/src/Ivy.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ivy.java')
-rwxr-xr-xsrc/Ivy.java29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/Ivy.java b/src/Ivy.java
index f7511ba..ad8a4e6 100755
--- a/src/Ivy.java
+++ b/src/Ivy.java
@@ -12,7 +12,6 @@ import java.net.*;
import java.io.*;
import java.util.Vector;
import java.util.Hashtable;
-import java.util.StringTokenizer;
/**
* A class connecting to the Ivy software bus.
@@ -260,11 +259,29 @@ public class Ivy implements Runnable, IvyApplicationListener {
if (callback==null){
throw new IvyException("(callCallback) Not regexp matching id "+key.intValue());
}
- StringTokenizer st = new StringTokenizer(msgarg,IvyClient.EndArg);
- String args[] = new String[st.countTokens()];
- int i=0;
- while (st.hasMoreTokens()){ args[i++] = st.nextToken();}
- callback.receive( client, args );
+ String[] tab= myTokenize(msgarg,IvyClient.EndArg);
+ System.out.println("received " + tab.length + " args");
+ callback.receive( client, tab);
+ }
+
+ private static String[] myTokenize(String s,String separator) {
+ int index=0, last=0, length=s.length();
+ Vector v = new Vector();
+ if (length!=0) while (true) {
+ index=s.indexOf(separator,last);
+ if (index==-1) {
+ v.add(s.substring(last,length));
+ break;
+ } else if (index<s.length()) {
+ v.add(s.substring(last,index));
+ last=index+1;
+ } else {
+ break;
+ }
+ }
+ String[] tab = new String[v.size()];
+ v.copyInto(tab);
+ return tab;
}