/* Marcus Daniels April 18, 2001 swarm-support Ok, the first time you run the program below it will write out an instance of itself to the file TestSaveString.scm. The second time you run it, the data will be loaded and printed. */ import swarm.Globals; import swarm.defobj.Archiver; public class TestSaveString { // Non public instance variables will be skipped public String str1; public String str2; TestSaveString () { str1 = "string 1"; str2 = "string 2"; } static void main (String args[]) { Globals.env.initSwarm ("TestSaveString", "0.0", "bug-swarm@swarm.org", args); // Use Globals.env.hdf5AppArchiver for HDF5 Archiver archiver = Globals.env.lispAppArchiver; // get the object back named "obj" TestSaveString obj = (TestSaveString) archiver.getObject ("obj"); if (obj != null) { System.out.println ("string 1: " + obj.str1); System.out.println ("string 2: " + obj.str2); } // save an instance of this class under the name "obj" archiver.putShallow$object ("obj", new TestSaveString ()); // always call sync after a set of puts archiver.sync (); } }