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

44
LINES

< > BotCompany Repo | #1024921 // Archive Contents

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (3111L/16K).

1  
!7
2  
3  
sclass Entry {
4  
  S name;
5  
  long size, compressedSize;
6  
  
7  
  sS _fieldOrder = "name size compressedSize";
8  
}
9  
10  
cmodule ArchiveContents > DynObjectTable<Entry> {
11  
  File archive;
12  
  
13  
  start {
14  
    itemToMap = func(Entry e) -> Map { litorderedmap(
15  
      "Name" := e.name,
16  
      "Size" := formatInt(e.size, 14),
17  
      "Compressed size" := formatInt(e.compressedSize, 14),
18  
    ) };
19  
  }
20  
  
21  
  visual withComputing(r {
22  
    // setting sorters only sometimes work (second time?)
23  
    addRowSorter(table());
24  
    rowSorter_setComparators(table(), 1, alphaNumComparator(), 2, alphaNumComparator());
25  
  },
26  
    withCenteredButtons(super, "Load archive...", rThread loadArchive));
27  
  
28  
  void loadArchive enter {
29  
    loadArchive(showFileChooser());
30  
  }
31  
  
32  
  // API
33  
  
34  
  void loadArchive(File f) {
35  
    setField(archive := f);
36  
    setModuleName(joinNempties(": ", "Archive contents", f2s(f)));
37  
    setData(map(listZipEntries(f), e ->
38  
      nu Entry(
39  
        name := e.getName(),
40  
        size := e.getSize(),
41  
        compressedSize := e.getCompressedSize()
42  
      )));
43  
  }
44  
}

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: #1024921
Snippet name: Archive Contents
Eternal ID of this version: #1024921/13
Text MD5: 28033c61582fd7e137c0c29d3c215043
Transpilation MD5: 18a7437420e8b9f0d6e440548ad75443
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-30 12:26:50
Source code size: 1092 bytes / 44 lines
Pitched / IR pitched: No / No
Views / Downloads: 306 / 490
Version history: 12 change(s)
Referenced in: [show references]