如何对一个XOR文件解异或
2013-09-10 18:06 totokaka 阅读(567) 评论(0) 编辑 收藏 举报import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class MyFileUtils { public static void xorDec(File srcfile,File desfile,byte xorchar) throws IOException{ FileInputStream fis = new FileInputStream(srcfile); FileOutputStream fos = new FileOutputStream(desfile); byte[] bs = new byte[1024]; int len = 0; while((len = fis.read(bs))!= -1){ for(int i = 0 ;i < len ;i++){ bs[i]^=xorchar; } fos.write(bs,0,len); } fis.close(); fos.close(); } }