package com.yinghuo.testDES;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import com.sun.corba.se.pept.encoding.OutputObject;
public class test1 {
public static void main(String[] args){
String inPath = "C:\\Users\\lb\\Desktop\\testDES\\encrypt.txt";
String outPath = "C:\\Users\\lb\\Desktop\\testDES\\write.txt";
readWriteFile(inPath, outPath);
}
public static void readWriteFile(String inPath, String outPath){
File inFile = new File(inPath);
File outFile = new File(outPath);
try {
InputStreamReader read = new InputStreamReader(new FileInputStream(inFile));
BufferedReader bufferR = new BufferedReader(read);
OutputStreamWriter write = new OutputStreamWriter(new FileOutputStream(outFile));
BufferedWriter out = new BufferedWriter(write);
String inLine;
if(inFile.isFile() && inFile.exists()){
while((inLine = bufferR.readLine()) != null){
out.write(inLine+"\r\n");
out.flush();
}
read.close();
write.close();
System.out.println("");
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}