public class Demo_jiami {
public static void main(String[] args) throws IOException {
Scanner input = new Scanner(System.in);
System.out.println("请输入要加密或解密的文件的绝对路径");
String filename = input.nextLine();
File oldfile = new File(filename);
File newfile = new File(oldfile.getParentFile(),"mi-"+oldfile.getName());
FileInputStream fis = new FileInputStream(oldfile);
FileOutputStream fos = new FileOutputStream(newfile);
while(true){
int b = fis.read();
if(b==-1){
break;
}
//数据^(异或)两次即还原
fos.write(b^10);
}
System.out.println("加密或解密已完成");
}
}