Libraryless. Click here for Pure Java version (90L/1K/4K).
!636 !modern main { psvm { split(args[0]); } static long splitSize = 1024*1024; // 0 = auto static int n; static void split(String path) ctex { File file = new File(path); print("== Processing " + path); long destSize = splitSize != 0 ? splitSize : file.length()/2; ZipFile zipFile = new ZipFile(file); Enumeration entries = zipFile.entries(); n = 1; String outPath = path + "." + n; print("Writing " + outPath); FileOutputStream fout = new FileOutputStream(outPath); ZipOutputStream zout = new ZipOutputStream(fout); long size = 0; while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); System.out.println("File found: " + entry.getName()); zout.putNextEntry(new ZipEntry(entry.getName())); InputStream fin = zipFile.getInputStream(entry); copyStream(fin, zout); fin.close(); size += entry.getCompressedSize(); if (size >= destSize) { size = 0; zout.close(); fout.close(); ++n; outPath = path + "." + n; print("Writing " + outPath); fout = new FileOutputStream(outPath); zout = new ZipOutputStream(fout); } } zout.close(); fout.close(); zipFile.close(); } }
Began life as a copy of #683
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1000728 |
| Snippet name: | Split zip/jar file into two |
| Eternal ID of this version: | #1000728/1 |
| Text MD5: | 7376ccf4189325b2cbe73ae452dde842 |
| Transpilation MD5: | 924113f1ddadd591bc1cfce677999ffc |
| Author: | stefan |
| Category: | |
| Type: | JavaX (input.txt to output.txt) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-08-24 01:31:07 |
| Source code size: | 1380 bytes / 52 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 1002 / 1429 |
| Referenced in: | [show references] |