如下代码:
异常原因是因为在输入过着输出流中没有定义文件名,而只有目录。
/**
* 字符流* @author Administrator
*
*/
public class Demo5 {
public static void stream() throws IOException {
InputStream inputStream = new FileInputStream("D:\\测试1\\123.txt");
OutputStream output = new FileOutputStream("D:\\测试2\\"); //here
int b = 0;
while((b = inputStream.read()) != -1) {
output.write(b);
}
inputStream.close();
output.close();
}
public static void main(String[] args) {
try {
stream();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}