PageRenderTime 157ms CodeModel.GetById 154ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-2-pre4/bsh/commands/load.bsh

#
Unknown | 22 lines | 17 code | 5 blank | 0 comment | 0 complexity | 3e0ebe34a8954f5b4d25e07502b7131b MD5 | raw file
 1/**
 2	Load a serialized Java object from filename.  Returns the object.
 3*/
 4
 5bsh.help.load = "usage: load(filename)";
 6
 7Object load( String filename ) 
 8{
 9	this.file = pathToFile( filename );
10
11	Object obj;
12	FileInputStream in = new FileInputStream( file );
13	ObjectInputStream oin = new ObjectInputStream(in);
14	obj = oin.readObject();
15	oin.close();
16
17	// bind bsh objects into the caller's namespace
18	if ( obj instanceof bsh.This )
19		bind( obj, this.caller.namespace );
20
21	return obj;
22}