安卓我可以通过Java编程破坏文件吗?还有可能扰乱文件内容吗?
我想通过java编程故意破坏一个文件。我听说您可以读取一个文件字节并向其添加任意随机字节,但我还不知道如何实际实现它你能提供一段代码吗
is it possible to scramble the contents of a file so that the file can be still opened but the content inside is no more readable
你可以在下面搜索框中键入要查询的问题!
我想通过java编程故意破坏一个文件。我听说您可以读取一个文件字节并向其添加任意随机字节,但我还不知道如何实际实现它你能提供一段代码吗
is it possible to scramble the contents of a file so that the file can be still opened but the content inside is no more readable
# 1 楼答案
一个简单的
RandomAccessFile
扰码器如下:RandomAccessFile
正是它听起来的样子,一个可以在任何位置读取和写入的文件。你可以通过调用randomAccessFile.seek(long position)
来选择职位。Random
听起来也是一个随机数、字节等的工厂。 所以本质上 A) 在任何位置打开文件进行读/写操作 B) 获取一个随机位置,获取一个随机字节,将随机字节写入随机位置 C) 重复B)进行scrambledByteCount
次