/jEdit/tags/jedit-4-0-pre3/bsh/commands/save.bsh

# · Unknown · 18 lines · 12 code · 6 blank · 0 comment · 0 complexity · 1ac5c83ff64807c4e0fe0d4ab318ae76 MD5 · raw file

  1. bsh.help.save = "usage: save( object, filename )";
  2. save( Object obj, String filename ) {
  3. file = pathToFile( filename );
  4. if ( !(obj instanceof Serializable) ) {
  5. print("Type "+obj.getClass()+" is not serializable");
  6. return;
  7. }
  8. out = new FileOutputStream( file );
  9. oout = new ObjectOutputStream(out);
  10. oout.writeObject( obj );
  11. oout.close();
  12. }