同学们,老师们,帮帮忙哈。
package IO;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class BUfferedInputStreamtest{
public void bufferedInputStreamtest(File srcFile,File descFile )
throws IOException{
if(!srcFile.exists()){
throw new IllegalArgumentException("您所输入的文件不存在!");
}if(!srcFile.isFile()){
throw new IllegalArgumentException("您输入的不是文件!");
}
BufferedInputStream bis=new BufferedInputStream(
new FileInputStream(srcFile));
BufferedOutputStream bos=new BufferedOutputStream(
new FileOutputStream(descFile) );
int b;
while((b=bis.read())!=-1){
bos.write(b);
bos.flush();
}
bis.close();
bos.close();
}
public static void main(String[] args) {
// TODO Auto-generated method stub
BUfferedInputStreamtest a=new BUfferedInputStreamtest();
try {
a.bufferedInputStreamtest(new File("f:\\迅雷下载\\java错题疑点.docx"),new
File(" f:\\迅雷下载\\文件1.docx"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}错误:
java.io.FileNotFoundException: f:\迅雷下载\文件1.docx (文件名、目录名或卷标语法不正确。)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at IO.BUfferedInputStreamtest.bufferedInputStreamtest(BUfferedInputStreamtest.java:21)
at IO.BUfferedInputStreamtest.main(BUfferedInputStreamtest.java
我的输出地址应该没有错吧