📄 crypt.java
字号:
/* * Crypt.java * 参见教程300页 示例程序10-6 * Created on 2005年8月5日, 下午3:33 * * @author Liu Yi ( http://www.liu-yi.net ) */package jbookch10;import java.io.*;public class Crypt { public static void main(String args[]) throws IOException { int i,j; FileInputStream fin; FileOutputStream fout; try { //打开源文件 try { fin=new FileInputStream(args[0]); }catch(FileNotFoundException e){ System.out.println("找不到源文件!"); return; } //打开目标文件 try { fout=new FileOutputStream(args[1]); }catch(FileNotFoundException e){ System.out.println("找不到目标文件!"); return; } }catch(Exception e){ System.out.println("程序运行正确格式: java Crypt 源文件名 目标文件名 " ); return; } //处理文件 try{ do{ i=fin.read(); j=i^CODE;//异或加解密 if (i != -1) fout.write(j); } while (i != -1); } catch (IOException e){ System.out.println("文件出错!" ); } fin.close(); fout.close(); } public static final int CODE = 8;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -