Import java.io.*;
/**
* <p>title: Read and write files (characters) </p>
* <p>description: Use the FileReader and FileWriter classes to manipulate files using character file access. </p>
* <p>copyright:copyright (c) 2003</p>
* <p>filename: </p>
* @version 1.0
*/
public class Copychar {
/**
*<br> Method Description: Main method
*<br> input Parameters:
*<br> return type:
*/
public static void Main (string[] args) throws IOException {
String sfile;
String ofile;
if (args.length<2) {
System.out.println ("Use:java Copychar source File | Object File ");
return;
}else{
sfile = args[0];
ofile = args[1];
}
try{
FileName inputfile = new file (sfile);//define the Read source
file outputfile = new file (ofile);//define the target files for the copy
//define input file stream
FileReader in = new FileReader (inputfile);
//construct the file input stream to the cache
BufferedReader bin = new BufferedReader (in);
//define output file stream
FileWriter out = new FileWriter (outputfile);
//The output file stream is constructed to the cache
bufferedwriter bout = new BufferedWriter (out);
int C;
//loop read and input files.
while ((c = bin.read ())!=-1)
Bout.write (c);
Bin.close ();
Bout.close ();
}catch (IOException e) {
//File operation, capturing IO exception.
System.err.println (e);
}
}
}
import java.io.*;
/**
* <p>title: File read and write (character) </p>
* <p>description: Use the FileReader and FileWriter classes to manipulate files using character file access. </p>
* <p>copyright:copyright (c) 2003</p>
* <p>filename: </p>
* @version 1.0
*/
public class Copychar {
/**
*<br> Method Description: Main method
*<br> input Parameters:
*<br> return type:
*/
public static void Main (string[] args) throws IOException {
String sfile;
String ofile;
if (args.length<2) {
System.out.println ("Use:java Copychar source File | Object File ");
return;
}else{
sfile = args[0];
ofile = args[1];
}
try{
Files Inputfile = new file (sfile);//definition Read source
file outputfile = new file (ofile);//define the target files for the copy
//define input file stream
FileReader in = new FileReader (inputfile);
//construct the file input stream to the cache
BufferedReader bin = new BufferedReader (in);
//define output file stream
FileWriter out = new FileWriter (outputfile);
//The output file stream is constructed to the cache
bufferedwriter bout = new BufferedWriter (out);
int C;
//loop read and input files.
while ((c = bin.read ())!=-1)
Bout.write (c);
Bin.close ();
Bout.close ();
}catch (IOException e) {
//File operation, capturing IO exception.
System.err.println (e);
}
}
}