1
2 package org.catacomb.serial;
3
4
5 import org.catacomb.report.E;
6
7
8
9 public class DataIO {
10
11
12 public static double[] readDoubleArray(String sin) {
13 String s = sin;
14 if (s.startsWith("{")) {
15 s = s.substring(1, s.indexOf("}"));
16 }
17 s = s.trim();
18
19 String[] sa = s.split("[ ,\t\n\r]+");
20
21
22
23
24
25
26
27
28 int nt = sa.length;
29 double[] value = new double[nt];
30
31 try {
32 for (int i = 0; i < nt; i++) {
33 value[i] = (new Double(sa[i])).doubleValue();
34 }
35 } catch (Exception ex) {
36 E.error("float reading cant extract " + nt + " doubles from " + s);
37 for (int i = 0; i < nt; i++) {
38 E.info("string " + i + "=xxx" + sa[i] + "xxx");
39 }
40 }
41
42 return value;
43 }
44
45
46
47
48 }