//Question: How can import some text into a pdb file to use in palm? //You can read the text from your desktop computer using java.io.* classes and use the class Catalog from SuperWaba to create the pdb file. Then, just //synchronize it to your palm. The following piece of code does that: import java.io.*; import waba.io.*; import java.util.*; // ps: this is a standard java file. run it with java.exe. to compile this file, //you must add the \waba\vmsrc\classes_java\ to your classpath public class TestFile { // reads a text file public static void readFile(Vector v, InputStream is) throws Exception { v.removeAllElements(); try { int b = is.read(); char c; String s = ""; while (b >= 0) { c = (char)b; if (c == '\n') { v.addElement(s); s = ""; } else s += c; b = is.read(); if ((char)b == '\r') b = is.read(); } if (s.length() > 0) v.addElement(s); } finally { is.close(); } } public static void main(String []args) { waba.applet.JavaBridge.setNonGUIApp(); try { // part 1 - reads the text file InputStream is = new FileInputStream("test.txt"); // could also use args[0] Vector v = new Vector(1024); readFile(v,is); // part 2 - open the catalog String creator = "jECb"; // replace with your app creator ID ! String typeC = "Q001"; // stands for My Data Catalog catC = new Catalog(typeC+"."+creator+"."+typeC,Catalog.READ_WRITE); if (!catC.isOpen()) catC = new Catalog(typeC+"."+creator+"."+typeC,Catalog.CREATE); ResizeStream csC = new ResizeStream(catC,1024); DataStream dsC = new DataStream(csC); // part 3 - writes the lines readen into separated records to the pdb file // note: you could also write it as one big string array, converting the Vector // o it and using the method dsC.writeStringArray. but it will be more memory consuming approach for (int i =0; i < v.size(); i++) { csC.startRecord(); dsC.writeString((String)v.elementAt(i)); csC.endRecord(); } dsC.close(); } catch (Exception e) {e.printStackTrace();} } }