/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
- bsh.help.save = "usage: save( object, filename )";
- save( Object obj, String filename ) {
- file = pathToFile( filename );
- if ( !(obj instanceof Serializable) ) {
- print("Type "+obj.getClass()+" is not serializable");
- return;
- }
-
- out = new FileOutputStream( file );
- oout = new ObjectOutputStream(out);
- oout.writeObject( obj );
- oout.close();
- }