PageRenderTime 136ms CodeModel.GetById 26ms RepoModel.GetById 6ms app.codeStats 0ms

/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
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  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. }