PageRenderTime 4ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-1-pre5/bsh/commands/load.bsh

#
Unknown | 21 lines | 16 code | 5 blank | 0 comment | 0 complexity | 7e8ef0b21d06afc6aa50a01431d7bc36 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	file = pathToFile( filename );
 9
10	Object obj;
11	FileInputStream in = new FileInputStream( file );
12	ObjectInputStream oin = new ObjectInputStream(in);
13	obj = oin.readObject();
14	oin.close();
15
16	// bind bsh objects into the caller's namespace
17	if ( obj instanceof bsh.This )
18		bind( obj, this.caller.namespace );
19
20	return obj;
21}