Package loginQQ; Import java. io. BufferedReader;
Import java. io. File; Import java. io. FileInputStream; Import java. io. InputStreamReader; Public class LoadingRead {
/**
* Read the configuration file */ Public static void main (String [] args ){ String endcode = "GBK "; File file = new File ("D:/Java/YT/src/com/YT/auto/word. ini "); InputStreamReader in = null; StringBuffer pzFile = new StringBuffer (); Try { If (file. isFile () & file. exists () {// checks whether a file exists. // Avoid Chinese character encoding Problems In = new InputStreamReader (new FileInputStream (file), endcode ); BufferedReader buffer = new BufferedReader (in ); String lineText = null; While (lineText = buffer. readLine ())! = Null ){ PzFile. append (lineText ); } System. out. println (pzFile ); } Else { System. out. println ("sorry, The INI file is not found "); } } Catch (Exception e ){ E. printStackTrace (); } } } |