zip4j,从输入流中提取受密码保护的文件(blob 输入流是一个 zip 文件)

jyo*_*eel 5 java zip4j

我有一个数据库,其中包含 blob 和该数据库内受密码保护的 zip,使用我传统上看到的标准文件对象方法

        File zipFile = new File("C:\\file.zip");        
        net.lingala.zip4j.core.ZipFile table = new net.lingala.zip4j.core.ZipFile(zipFile);                    
        if (table.isEncrypted())
            table.setPassword(password);           

        net.lingala.zip4j.model.FileHeader entry = table.getFileHeader("file_inside_the_zip.txt");
        return table.getInputStream(entry); //Decrypted inputsteam!
Run Code Online (Sandbox Code Playgroud)

我的问题是,我如何在不使用临时文件的情况下实现这样的东西,并且纯粹单独获取 blob 的输入流,到目前为止我有这样的东西

InputStream zipStream = getFileFromDataBase("stuff.zip");
//This point forward I have to save zipStream as a temporary file and use the traditional code above
Run Code Online (Sandbox Code Playgroud)

Ale*_*lex 0

我相信通过 zip4j 是不可能的,因为它非常以文件为中心。

看看这个:http://blog.alutam.com/2012/03/31/new-library-for-reading-and-writing-zip-files-in-java/