: eval 'exec perl -w -S `echo $0 | sed "s/.*\///" ` ${1+"$@"}' if 0; @a=@ARGV; @flags=grep(/^-/,@a); @other=(); @other=grep(!/^-/,@a); if ( grep( /^-h(elp)?$/,@flags) || scalar(@other) != 1) { $scriptName = $0; $scriptName =~ s%^.*/%%; print <<"END"; Usage: $scriptName [-h -help] Class Print out a prototype of a new java class that implements Serializable. END exit;} $rN="\n"; $rN="\n" if ( ! -d "/var" ); $Class=$a[0]; print <<"END"; public class $Class implements java.io.Serializable { private static final long serialVersionUID = 1L; // try never to change private static final int VERSION = 1; // compatible change in serialization private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { java.util.HashMap map = new java.util.HashMap(); map.put("data", data); map.put("VERSION", VERSION); out.writeObject(map); } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { \@SuppressWarnings("unchecked") java.util.Map map = (java.util.Map) in.readObject(); data = (double[]) map.get("data"); int version = (Integer) map.get("VERSION"); if (version != VERSION) { java.util.logging.Logger.getLogger(this.getClass().getName()).warning ("Need to convert data from version "+version+" to "+VERSION); } if (map.size() != 2) { java.util.logging.Logger.getLogger(this.getClass().getName()).warning ("Found "+map.size()+" members when deserializing "+ this.getClass().getName()); } } } END