Menu

Unable to view files obtained after compression

Astha
2022-03-21
2023-12-21
  • Astha

    Astha - 2022-03-21

    I'm using an Android wrapper over 7Zip-Jbinding and facing an issue with compressing files other than .txt.
    I tried picking mp4 and .docx files from my assets folder(in Android project) and found that the zip is created sucessfully but when I tried opening the compressed files after extracting, I'm unable to do so seems the files are corrupted. However same is file with .txt files.

    Also the obtained files are under directoy strtucre as that of asset folder from where I picked my files.

    Can't we compress files other than txt using 7zip-JBinding?
    or is it some issue at my end?

    Let me know if you need more details from my end.
    github library I'm using https://github.com/omicronapps/7-Zip-JBinding-4Android

     
  • Astha

    Astha - 2022-04-07

    I have found the solution. Can close this

     
  • Ilia S

    Ilia S - 2023-12-21

    Please describe your decision. I faced the same problem.

    Thanks

     
  • Ilia S

    Ilia S - 2023-12-21

    It works correctly with FileOutputStream with parameter 'true'.

    result = item.extractSlow(new ISequentialOutStream() {
                            @SneakyThrows
                            public int write(byte[] data) throws SevenZipException {
                                FileOutputStream wr = null;
                                try {
                                    wr = new FileOutputStream("c:\\Users\\1\\tt.pdf", true);
                                    wr.write(data);
                                } catch (FileNotFoundException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                } catch (IOException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                } finally {
                                    if (wr != null) {
                                        wr.close();
                                    }
                                }
                                }
                                }
    
     

Log in to post a comment.

MongoDB Logo MongoDB