2

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!

私の質問は、一時ファイルを使用せずにこのようなものを実装し、ブロブだけの入力ストリームを純粋に取得する方法です。これまでのところ、このようなものがあります

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

4 に答える 4

0

zip4j はファイル中心であるため、zip4j 経由では不可能だと思います。

これを見てください:http://blog.alutam.com/2012/03/31/new-library-for-reading-and-writing-zip-files-in-Java/

于 2016-10-10T14:43:49.813 に答える