Uses 578K of libraries. Click here for Pure Java version (2597L/17K).
1 | !include once #1024944 // Apache Commons Compress |
2 | |
3 | import org.apache.commons.compress.archivers.tar.*; |
4 | |
5 | svoid zip2tar(File inZip, File outTar) ctex {
|
6 | temp FileOutputStream out = newFileOutputStream(outTar); |
7 | zip2tar(inZip, out); |
8 | } |
9 | |
10 | svoid zip2tar(File inZip, OutputStream out) {
|
11 | zip2tar(inZip, bufferedOutputStream(out)); |
12 | } |
13 | |
14 | svoid zip2tar(File inZip, BufferedOutputStream out) ctex {
|
15 | TarArchiveOutputStream tarOut = new(out); |
16 | tarOut.setLongFileMode(tarOut.LONGFILE_GNU); |
17 | zip2tar(inZip, tarOut); |
18 | out.flush(); |
19 | } |
20 | |
21 | svoid zip2tar(File inZip, TarArchiveOutputStream outTar) ctex {
|
22 | ZipFile zipFile = new ZipFile(inZip); |
23 | Enumeration entries = zipFile.entries(); |
24 | while (entries.hasMoreElements()) {
|
25 | ZipEntry entry = (ZipEntry) entries.nextElement(); |
26 | //System.out.println("Copying " + entry.getName());
|
27 | TarArchiveEntry te = new(entry.getName()); |
28 | te.setModTime(entry.getTime()); |
29 | te.setSize(entry.getSize()); |
30 | outTar.putArchiveEntry(te); |
31 | |
32 | InputStream fin = zipFile.getInputStream(entry); |
33 | copyStream(fin, outTar); |
34 | fin.close(); |
35 | outTar.closeArchiveEntry(); |
36 | } |
37 | outTar.flush(); |
38 | zipFile.close(); |
39 | } |
Began life as a copy of #1001173
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1024945 |
| Snippet name: | zip2tar |
| Eternal ID of this version: | #1024945/23 |
| Text MD5: | b7e65eb98c796021ae5c39a040785752 |
| Transpilation MD5: | f9d7720711c4fc8b81dff9208b923aa2 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-05-26 22:18:45 |
| Source code size: | 1180 bytes / 39 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 491 / 701 |
| Version history: | 22 change(s) |
| Referenced in: | [show references] |