修改ZipFile类以将编码文件用作zip文件

时间:2022-11-19 20:27:25

The idea is to encrypt a jar file, actually to encode it inorder to make it impossible to open with zip utility software (eg: winzip, winrar or ...).

这个想法是加密一个jar文件,实际上是为了编码它,以便无法用zip实用软件打开它(例如:winzip,winrar或......)。

For encoding the jar file, i have just increment every byte of jar file for test purpose. then i want to read the encoded jar file as ZipFile to work with its data like a real jar file.

为了编码jar文件,我只是增加了jar文件的每个字节以供测试。然后我想读取编码的jar文件作为ZipFile来处理它的数据,如真正的jar文件。

Now the problems is that when i initialize a ZipFile, it needs an reference of file, which the ZipFile class always consider that the file is a Zip file; but actually it is not.

现在的问题是,当我初始化ZipFile时,它需要一个文件的引用,ZipFile类总是认为该文件是一个Zip文件;但实际上并非如此。

i want to change the read(...) method of ZipFile or any other method that deals with the input stream, to perform the decoding while reading the data from stream.

我想更改ZipFile的read(...)方法或任何其他处理输入流的方法,以便在从流中读取数据时执行解码。

if any body can help with this solution or have any suggestion please tell me.

如果有任何机构可以帮助解决这个问题或有任何建议请告诉我。

1 个解决方案

#1


0  

you could use the stream version of ZipFile, ZipInpuStream. it does not care the stream you supplied is modified or not.

你可以使用ZipFile的流版本,ZipInpuStream。它并不关心您提供的流是否被修改。

#1


0  

you could use the stream version of ZipFile, ZipInpuStream. it does not care the stream you supplied is modified or not.

你可以使用ZipFile的流版本,ZipInpuStream。它并不关心您提供的流是否被修改。