[Java] 纯文本查看 复制代码 import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class Demo1_BufferedInputStream {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedInputStream bis = new BufferedInputStream(new FileInputStream("E:\\1.jpg"));
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("E:\\crypt.jpg"));
encrypt(bis,bos);
}
private static void encrypt(BufferedInputStream bis, BufferedOutputStream bos) throws IOException {
//加密文件
int b;
while ((b = bis.read()) != -1) {
[b] bos.write(b ^ 256);[/b]
}
bis.close();
bos.close();
}
}
一个文件异或256(bos.write(b ^ 256);)文件没有被加密,这是怎么回事呢?
|