上传者: gangshou
|
上传时间: 2023-12-19 07:03:03
|
文件大小: 33KB
|
文件类型: DOC
package hustspy.encrypt;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class FileOperation {
public static void main(String[] args) {
String src = "111.txt";
String dec = "222.txt";
try {
FileInputStream in = new FileInputStream(src);
// File file = new File(dec);
// if(!file.exists())
// file.createNewFile();
FileOutputStream out = new FileOutputStream(dec);
byte buffer[] = new byte[1024];
int count,i;
while((count=in.read(buffer))!=-1){
// for循环保证只写入count个byte, 否则会写入1024个byte
for(i=0; i