我要复制一个目录下的shtml文件和xml文件到另一个路径下,shtml文件的名字为index,
而xml文件的名字要到index.shtml文件中找,index.shtml中.....=XXX.xml....这样出现的。
下面的是我写的代码,index.shtml文件可以拷贝到另一路径下,可是xml文件就没有,我不知道什么原因。。
请大家帮我看看!try{
InputStream fis = new FileInputStream(inputurl);
OutputStream fos = new FileOutputStream(outputurl);
//BufferedReader br = new BufferedReader(new InputStreamReader(inputurl)); 
//FileReader fr=new FileReader(inputurl);
while((c=fis.read()) != -1){
fos.write(c);
}
fos.flush();
fos.close();
fis.close();
BufferedReader Br=new BufferedReader(new FileReader(inputurl)); //xml
String xml = Br.readLine();   

int begin = xml.indexOf("="); 
int end = xml.indexOf(".xml",begin); 
if(begin>=0&&xml.indexOf(".xml")>=0){
String rtn = xml.substring(begin,end); //xml
name = rtn.substring(1);

String inputurl1 = application.getRealPath("/")+cunbanPath+"/"+name+".xml";//合成路径
String outputurl1 = application.getRealPath("/")+"/cunban"+cunbanPath+"/"+d+duanTime+".xml";
InputStream fis1 = new FileInputStream(inputurl1);
OutputStream fos1 = new FileOutputStream(outputurl1);
while((x=fis1.read()) != -1){
fos1.write(x);
}
//fos1.flush();

fos1.close();
fis1.close();
}

}catch(Exception e){
out.println(e);

}