有一个知识点卡住了,向各位大神请教
public class IO00 {
public static void merge(String[] fileName,String TargetFileName) throws Exception{
File fin=null;
//构建文件输出流
File fout=new File(TargetFileName);
FileOutputStream out=new FileOutputStream(fout);
for(int i=0;i<fileName.length;i++){
//打开文件输入流
fin=new File(fileName[i]);
FileInputStream in=new FileInputStream(fin);
//从输入流中读取数据,并写入到文件输出流中
int c;
while((c=in.read())!=-1){
out.write(c);
}
in.close();
}
out.close();
System.out.println("合并文件"+TargetFileName+"中的内容如下!!!");
}
public static void readFileMessage(String fileName){//将合成的文件中的内容读出
File file=new File(fileName);
BufferedReader br=null;
try {
br=new BufferedReader(new FileReader(file));
String string=null;
//按行读取内容,直到读入null则表示读取文件结束
while((string=br.readLine()) != null){
System.out.println(string);
}
br.close();
} catch (Exception e) {
e.printStackTrace();
}finally{
if(br != null){
try {
br.close();
} catch (Exception e2) {
// TODO: handle exception
}
}
}
}
public static void main(String[] args) throws Exception {
String fis1="E:\\Text1.txt";
String fis2="E:\\Text2.txt";
String fis3="E:\\Text3.txt";
String terget="E:\\Sequence.txt";
//merge(args,terget);
readFileMessage(terget);
}
}
这里的args该填写什么呢??
...全文
相关推荐
快速解决idea打开某个项目卡住的问题
知识点:* IDEA 打开某个项目卡住的问题的解决方法* 项目列表的文件路径和结构* 删除有问题的项目来解决问题* IDEA 的项目状态和配置记录机制
C# winform 防止界面卡住 线程 委托
在C# WinForm中,防止界面卡住的基本步骤如下:1. 创建新的线程:使用`System.Threading.Thread`类创建一个新的线程。
Oracle lsnrctl status卡住问题解决
,可能会导致`lsnrctl status`命令无法确定应该连接哪一个监听器,从而出现卡住的现象。
解决Python设置函数调用超时,进程卡住的问题
,当函数在指定时间内未完成执行时,程序能够自动捕获并处理这个超时,避免进程卡住。
卡住
**无限循环**:检查循环条件,确保循环有一个明确的结束条件。避免在循环条件中使用可能永远不会变为假的表达式。8. **错误处理**:在C语言中,许多函数返回错误代码而非抛出异常。


Java SE
