Uploaded image for project: 'Commons Compress'
  1. Commons Compress
  2. COMPRESS-261

Unable to set SevenZOutputFile.setContentCompression() per SevenZArchiveEntry

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7
    • Fix Version/s: 1.8
    • Component/s: None
    • Labels:
      None
    • Environment:

      xz-1.4.jar is used as LMZA lib

      Description

      I am unable to set the compression method per archive entry. In my example I try to switch from LZMA2 to COPY for the second entry. But 7zip says that both entry has COPY as compression method.

      public static void main(String args[]) throws Exception {
      		String t = "Das ist ein kleiner Test!";
      
      		SevenZOutputFile sevenZOutput = new SevenZOutputFile(new File(
      				"c:/tmp/test.7z"));
      		sevenZOutput.setContentCompression(SevenZMethod.LZMA2);
      		SevenZArchiveEntry entry = new SevenZArchiveEntry();
      		entry.setName("test");
      		sevenZOutput.putArchiveEntry(entry);
      		sevenZOutput.write(t.getBytes());
      		sevenZOutput.closeArchiveEntry();
                     sevenZOutput.setContentCompression(SevenZMethod.COPY);	
      		entry = new SevenZArchiveEntry();
      		entry.setName("test2");
      		sevenZOutput.putArchiveEntry(entry);
      		sevenZOutput.write(t.getBytes());
      		sevenZOutput.closeArchiveEntry();
      		sevenZOutput.finish();	
      		sevenZOutput.close();
      	}
      
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              pezi Peter Sauer
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: