;;;;;;;;lassAddList{ privateStringfilePath=""; privateStringbakPath=""; privateStringcontent=""; Scannersc=newScanner(); publicStringreadFile(){ content=""; if(isNull(filePath)){ ("文件存储路径:"); filePath=(); } Filefile=newFile(filePath); FileReaderfr=null; try{ if(()){ fr=newFileReader(file); char[]chars=newchar[1024]; intn=0; while((n=(chars))!=-1){ Stringstring=newString(chars,0,n); content=content+string; } }else{ ("文件不存在"); } }catch(Exceptione){ (); }finally{ if(fr!=null){ try{ (); }catch(IOExceptione){ (); } } } returncontent; } publicvoidwriteFile(Stringpath){ Filefile=newFile(path); FileOutputStreamfos=null; mkDirs(path); try{ fos=newFileOutputStream(file); BufferedOutputStreambos=newBufferedOutputStream(fos); PrintWriterpw=newPrintWriter(bos,true); (content); (); }catch(FileNotFoundExceptione){ (); }finally{ if(fos!=null){ try{ (); }catch(IOExceptione){ (); } } } } publicvoidwriteFile(){ if(isNull(filePath)){
java通讯录源代码 来自淘豆网m.daumloan.com转载请标明出处.