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

23
LINES

< > BotCompany Repo | #1001340 // zipBot

JavaX fragment (include)

1  
static int zipBot_compressionLevel = 9; // highest!
2  
3  
// returns true if actual zip file (not empty)
4  
static boolean zipBot(S botToZip, File destZip) ctex {
5  
  File dir = getProgramDir(botToZip);
6  
  
7  
  mkdirsForFile(destZip);
8  
  FileOutputStream fout = new FileOutputStream(destZip);
9  
  ZipOutputStream zout = new ZipOutputStream(fout);
10  
  zout.setLevel(zipBot_compressionLevel);
11  
  int count = 0;
12  
  if (dir.isDirectory())
13  
    count += dir2zip(dir, zout, "JavaX-Data/" + botToZip + "/");
14  
  if (count == 0) {
15  
    print("Nothing to zip for bot " + botToZip);
16  
    fout.close();
17  
    return false;
18  
  } else {
19  
    zout.close();
20  
    print("Zipped " + botToZip + " (" + count + " entries) to " + destZip.getAbsolutePath() + " (" + destZip.length() + " bytes)");
21  
    return true;
22  
  }
23  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001340
Snippet name: zipBot
Eternal ID of this version: #1001340/1
Text MD5: c9773d99cdc0e9fa565c39be3c37dbb1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-17 14:39:25
Source code size: 790 bytes / 23 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 780 / 1009
Referenced in: [show references]