/jEdit/tags/jedit-4-3-pre5/bsh/commands/load.bsh
# · Unknown · 22 lines · 17 code · 5 blank · 0 comment · 0 complexity · 3e0ebe34a8954f5b4d25e07502b7131b MD5 · raw file
- /**
- Load a serialized Java object from filename. Returns the object.
- */
- bsh.help.load = "usage: load(filename)";
- Object load( String filename )
- {
- this.file = pathToFile( filename );
- Object obj;
- FileInputStream in = new FileInputStream( file );
- ObjectInputStream oin = new ObjectInputStream(in);
- obj = oin.readObject();
- oin.close();
- // bind bsh objects into the caller's namespace
- if ( obj instanceof bsh.This )
- bind( obj, this.caller.namespace );
- return obj;
- }