Topic: 欢迎指教——文件操作的两个例子

  Print this page

1.欢迎指教——文件操作的两个例子 Copy to clipboard
Posted by: 铁针
Posted on: 2003-02-19 13:55

配置文件读,文件COPY,删除,移动

file.zip (3.4k)

2.Re:欢迎指教——文件操作的两个例子 [Re: 铁针] Copy to clipboard
Posted by: luaoun
Posted on: 2003-02-19 14:36

下载了先看看。

3.Re:欢迎指教——文件操作的两个例子 [Re: 铁针] Copy to clipboard
Posted by: floater
Posted on: 2003-02-20 05:27

PropertyFile:
1. declare your string constant as final
2. don't declare token(StringTokenizer) as a private member, since it's not quite relevent to your class, declare it in the block where you are using it.
3. userSectionLeftMark = (leftMark==null)?defaultSectionLeftMark:leftMark;
and similar to the rest.
4. This block:
try{
      raf = new RandomAccessFile(path_and_name,mod);      
      }catch(IllegalArgumentException arg){}
      catch(FileNotFoundException fileNotFound){}
I just don't feel right about this. It shouldn't be in the constructor because it's hard to deal with the exceptions(The general rule is to make your constructor as simple as possible). These exceptions are serious exceptions and it would be better to handle them, rather than leave them blank. This block shows at least 3 times in the file, so make a method of this.
5. The getValue(...) method: fix those String constants(the logic between user settings and default is twisted!), and move those checking out to somewhere else.
6. Whenever possible, catch all exceptions.
7. put your manaty.ini testing file in the comment too so users could follow you. Some of the comments are hard to understand.

My personal view for reference.

4.Re:欢迎指教——文件操作的两个例子 [Re: 铁针] Copy to clipboard
Posted by: daywalker
Posted on: 2003-02-20 10:43

下载了先看看

5.manaty.ini [Re: 铁针] Copy to clipboard
Posted by: 铁针
Posted on: 2003-02-20 14:43



manaty.ini (0.07k)


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923