|
Исходный текст программы MergeFiles.java
|
Оглавление |
Назад
// ==========================================
// MergeFiles.java
// (C) Alexandr Frolov, 1998
// E-mail: frolov@glasnet.ru
// Web: http://www.glasnet.ru/~frolov
// ==========================================
import java.io.*;
import java.util.*;
public class MergeFiles
{
public static void main(String args[])
{
SequenceInputStream sis;
FileOutputStream fos;
if(args.length == 2)
{
System.out.println("Merge: " +
args[0] + ", " + args[1]);
try
{
sis = new SequenceInputStream(
new FileInputStream(args[0]),
new FileInputStream(args[1]));
fos = new FileOutputStream(
"!merged.txt");
int b;
while(true)
{
b = sis.read();
if(b == -1)
break;
fos.write(b);
}
sis.close();
fos.close();
}
catch (IOException ex)
{
System.out.println(ex.toString());
System.exit(0);
}
}
else
System.out.println("Args: name1 name2");
}
}
|
|