/*** @ Param userinfomap user registration information * @ throws ioexception filenotfoundexception * @ return write user information to the CSV file */public static void writecsv (Map <string, string> userinfomap) {try {// file path for storing dealer ID and dealer information string csvpath = fileutil. getworkingpath (). resolve (configutil. getconfig (). get ("idmappings ")). tostring (); // append the original content. If true is changed to false or the default value is not, the original content will be deleted, and fileoutputstream = new fileoutputstream (csvpath, true) will be added ); // UTF-8 write to prevent garbled outputstreamwriter = new outputstreamwriter (fileoutputstream, "UTF-8"); // catch-up mode bufferedwriter BW = new bufferedwriter (outputstreamwriter); // Add a row of Data BW. newline (); BW. write (userinfomap. get ("openid") + "," + userinfomap. get ("deptid") + "," + userinfomap. get ("deptname") + "," + userinfomap. get ("rolename"); BW. close ();} catch (filenotfoundexception e) {// catch the exception e when the file object is generated. printstacktrace ();} catch (ioexception e) {// catch the exception E. printstacktrace ();}}
This article from "Yu Hong produced" blog, please be sure to keep this source http://5fresh.blog.51cto.com/5472694/1433839