Import Java. io. fileinputstream; import Java. io. filenotfoundexception; import Java. io. fileoutputstream; import Java. io. ioexception; import Java. io. printstream; import Java. util. properties; public class properutil {private properties propertie; private fileinputstream inputfile; private fileoutputstream outputfile; Public properutil () {This. propertie = new properties ();} public properutil (string filepath) {thi S. propertie = new properties (); try {This. inputfile = new fileinputstream (filepath); this. propertie. load (this. inputfile); this. inputfile. close ();} catch (filenotfoundexception ex) {system. out. println ("failed to read attribute file --->! -Cause: the file path is incorrect or the file does not exist "); Ex. printstacktrace ();} catch (ioexception ex) {system. Out. println (" loading file ---> failed! "); Ex. printstacktrace () ;}} Public String getvalue (string key) {If (this. propertie. containskey (key) {string value = This. propertie. getproperty (key); return value;} return "";} Public String getvalue (string filename, string key) {try {string value = ""; this. inputfile = new fileinputstream (filename); this. propertie. load (this. inputfile); string str1; If (this. propertie. containskey (key) {value = This. propertie. getproperty (key); str1 = value; return str1;} return value;} catch (filenotfoundexception e) {e. printstacktrace (); Return "";} catch (ioexception e) {e. printstacktrace (); Return "";} catch (exception ex) {ex. printstacktrace (); Return "" ;}finally {try {This. inputfile. close ();} catch (ioexception e) {e. printstacktrace () ;}} public void clear () {This. propertie. clear ();} public void setvalue (string key, string value) {This. propertie. setproperty (Key, value);} public void SaveFile (string filename, string description) {try {This. outputfile = new fileoutputstream (filename); this. propertie. store (this. outputfile, description);} catch (filenotfoundexception e) {e. printstacktrace ();} catch (ioexception IOE) {IOE. printstacktrace ();} finally {try {This. outputfile. close ();} catch (ioexception e) {e. printstacktrace () ;}} public properties getpropertie () {return this. propertie;} public static void main (string [] ARGs ){}}