Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

20
LINES

< > BotCompany Repo | #1024956 // tarInJar_withMD5 - repacks a .jar file, puts all files in bulk-{md5}.tar [dev.]

JavaX fragment (include) [tags: use-pretranspiled]

Uses 578K of libraries. Click here for Pure Java version (2497L/17K).

1  
svoid tarInJar_withMD5(File jarIn, File jarOut) ctex {
2  
  print("tarInJar_withMD5 " + f2s(jarIn) + " => " + f2s(jarOut));
3  
  File tar = createTempFile("", ".tar");
4  
  print("  temp: " + f2s(tar));
5  
  temp tempDeleteFile(tar);
6  
  zip2tar(jarIn, tar);
7  
  temp ZipOutputStream zipOut = zipOutputStream(jarOut);
8  
  file2zip(zipOut, tar, "bulk-" + md5(tar) + ".tar");
9  
}
10  
11  
svoid tarInJar_withMD5(File jarIn) {
12  
  if (!fileExists(jarIn)) ret;
13  
  File jarOut = fileInSameDirectory(jarIn, dropSuffixIC(".jar", jarIn.getName()) + ".repacked.jar");
14  
  renameFileToUniqueName(jarOut); // backup old version
15  
  tarInJar_withMD5(jarIn, jarOut);
16  
}
17  
18  
svoid tarInJar_withMD5(S jarIn) {
19  
  tarInJar_withMD5(newFile(jarIn));
20  
}

Author comment

Began life as a copy of #1024946

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024956
Snippet name: tarInJar_withMD5 - repacks a .jar file, puts all files in bulk-{md5}.tar [dev.]
Eternal ID of this version: #1024956/7
Text MD5: 1faec90cc6df404d8875aa20fd5bafa0
Transpilation MD5: a4a66d9e353d294b9353d568101bd723
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-31 16:37:43
Source code size: 712 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 246 / 358
Version history: 6 change(s)
Referenced in: [show references]