作者TonyQ (骨头)
看板java
标题Re: [问题] 读档的API?
时间Fri Mar 16 11:27:17 2007
※ 引述《frex (Frex)》之铭言:
: 有没有API是可以
: 把整个目录下(包含子目录)
: 中的 *.xxx(指定) 的档
: 分别一个一个档读进来
: 用途是我想把所有的程式码中*.JSP
: 某段文字置换掉 一个一个改很麻烦
: 或者有更好的方法?
http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html
有isDirectory() (判断是否为资料夹)
还有
String[] list()
Returns an array of strings naming the files and directories in the
directory denoted by this abstract pathname.
可以判断底下的档案(或资料夹)
配起来应该就够用了 :P
或者是底下的这个 class
*修改*
我手残了 贴到 FileFilter XD
我脑袋想的是FilenameFilter的呀
http://java.sun.com/j2se/1.5.0/docs/api/java/io/FilenameFilter.html
btw , 把java APP写成能处理一个档案,
然後用批次档去处理或许也是一个好主意。
(如果程式本身是servlet或jsp就不能这样玩了XD)
--
String temp="relax"; | Life just like programing
while(buringlife) String.forgot(temp); | to be right or wrong
while(sleeping) brain.setMemoryOut(); | need not to say
stack.push(life.running); | the complier will
stack.push(scouting.buck()); | answer your life
stack.push(bowling.practice()); | Bone
everything
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.134.27.68
※ 编辑: TonyQ 来自: 220.134.27.68 (03/16 11:28)