Dear Wiki user, You have subscribed to a wiki page or wiki category on "Jakarta-commons Wiki" for change notification.
The following page has been changed by ChristianGrobmeier: http://wiki.apache.org/jakarta-commons/Compress The comment on the change is: formatted code snippets ------------------------------------------------------------------------------ To pack an archive, you have to get an archiver via the ArchiverFactory. At the moment it's possible to get a "zip" or a "tar" archiver. Add your files to the archiver and call save to store the archive. === Packing a ZIP-File === - Archive archiver = ArchiverFactory.getInstance("zip"); + {{{Archive archiver = ArchiverFactory.getInstance("zip"); archiver.add( new File("C:\\Temp\\1.html")); archiver.add( new File("C:\\Temp\\1.html.bz2")); - archiver.save( new File("C:\\Temp\\ZIPTEST.zip")); + archiver.save( new File("C:\\Temp\\ZIPTEST.zip"));}}} === Unpacking a ZIP-File === - Archive archiver = ArchiverFactory.getInstance( + {{{Archive archiver = ArchiverFactory.getInstance( new File("C:\\Temp\\ZIPTEST.zip")); - archiver.unpack( new File("C:\\Temp\\unpacked\\")); + archiver.unpack( new File("C:\\Temp\\unpacked\\"));}}} == Compressor == Same goes for Compressor. At the moment there is only "bz2" support. === Compressing a file === - Compressor compressor; + {{{Compressor compressor; compressor = CompressorFactory.getInstance("bz2"); - compressor.compressToHere( new File("C:\\Temp\\test.tar")); + compressor.compressToHere( new File("C:\\Temp\\test.tar"));}}} === Decompressing a file === - Compressor decompressor; + {{{Compressor decompressor; decompressor = CompressorFactory.getInstance("bz2"); decompressor.decompressTo( new File("C:\\Temp\\asf-logo-huge.tar.bz2"), - new File("C:\\Temp\\asf-logo-huge.tar")); + new File("C:\\Temp\\asf-logo-huge.tar"));}}} = FAQ = --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
