Skip to content

Commit

Permalink
initial imports
Browse files Browse the repository at this point in the history
  • Loading branch information
umjammer committed Feb 4, 2024
0 parents commit 84253f5
Show file tree
Hide file tree
Showing 44 changed files with 3,732 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
# schedule:
# - cron: '19 18 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'java' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
- name: Build with Maven
run: mvn -B package --file pom.xml -Dmaven.test.skip=true

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
32 changes: 32 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Java CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: macos-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Check w/o SNAPSHOT when "bump version"
if: ${{ contains(github.event.head_commit.message, 'bump version') }}
run: grep "<version>" pom.xml | head -1 | grep -v SNAPSHOT

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven

- name: Build with Maven
run: |
brew install unar
mvn -B package --file pom.xml
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
local.properties
tmp/
124 changes: 124 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
[![Release](https://jitpack.io/v/umjammer/vavi-util-archive-xad.svg)](https://jitpack.io/#umjammer/vavi-util-archive-xad)
[![Java CI](https://github.com/umjammer/vavi-util-archive-xad/actions/workflows/maven.yml/badge.svg)](https://github.com/umjammer/vavi-util-archive-xad/actions/workflows/maven.yml)
[![CodeQL](https://github.com/umjammer/vavi-util-archive-xad/actions/workflows/codeql.yml/badge.svg)](https://github.com/umjammer/vavi-util-archive-xad/actions/workflows/codeql-analysis.yml)
![Java](https://img.shields.io/badge/Java-17-b07219)

# vavi-util-archive-xad

archiver spi over mac [The Unarchiver XADMaster part](https://github.com/MacPaw/XADMaster) by jna

## Install

### xad

* install

```shell
$ brew intall unar
```

* link for private frameworks location

```shell
$ cd ~/Library/Frameworks/
$ ln -s /opt/homebrew/Cellar/xad/x.xx.x/Frameworks/UniversalDetector.framework .
$ ln -s /opt/homebrew/Cellar/xad/x.xx.x/Frameworks/XADMaster.framework .
```

or

* java option

```
-Djna.library.path=/opt/homebrew/Frameworks/...
```

### maven

* https://jitpack.io/#umjammer/vavi-util-archive-xad

## Usage

```java
Archive archive = Archives.getArchive(Paths.get("foo/bar.7z").toFile());
Path outDir = Paths.get("foo/bar");
for (Entry entry : archive.entries()) {
Files.copy(archive.getInputStream(entry), outDir.resolve(entry.getName()));
}
```

## References

* https://github.com/MacPaw/XADMaster
* https://theunarchiver.com/command-line
* https://github.com/ashang/unar

## TODO

* frameworks setting for github actions

## Supported Formats

### Supported popular formats
| Format | Support level | Notes |
|:-------|:--------------|:------|
| Zip | Full | Full support for the normal zip format, with additional support for AES encryption, Zip64 extensions for large files, Mac OS extensions of many different kinds, and several unusual compression methods (Deflate64, Bzip, LZMA, PPMd). Can also extract .EXE self-extracting files using Zip. |
| RAR | Full | Including encryption and multiple volumes. Can also extract .EXE self-extracting files using RAR. |
| 7z | No encryption | Most compression methods are supported, but no encryption. Also supports Unix extensions. |
| Tar | Full |
| | Gzip | Full |
| | Bzip2 | Full |
| | LZMA, XZ | Full | Both the old "LZMA-alone" format, usually named .lzma, and the new .xz format. |
| CAB | Full |
| | MSI | Full | This format is also used by many other Microsoft formats, meanings that you can use The Unarchiver to extract internal data from DOC and PPT files, and others. There is probably no reason to do this, but you can. |
| NSIS | Extensive | Supports many different versions, starting from version 1.1o |
| EXE | Some | Many kinds of .exe self-extracting formats are supported. However, if you find one that is not, please post an issue on the bug tracker. |
| ISO | Full | ISO 9660 CDROM filesystem images, and also .bin raw images. |
| Split files | Basic | Can join files named .001, .002 that do not use any extra wrapper format. |

### Supported old formats
| Format | Support level | Was popular on | Notes |
|:-------|:--------------|:---------------|:------|
| StuffIt | No encryption | Mac OS | Can unpack all files I've been able to locate. |
| StuffIt X | Partial | Mac OS | Can unpack many files, some more obscure features are still unsupported. JPEG compression is also unsupported. |
| DiskDoubler | Almost full | Mac OS | All compression algorithms are implemented, but a few rare ones are untested. If you have some files that do not work, please post them in issue 149 on the bug tracker. |
| Compact Pro | No encryption | Mac OS |
| | PackIt | Full | Mac OS |
| | Cpio | Full | Unix |
| | Compress (.Z) | Full | Unix |
| | ARJ | No multi-part | DOS |
| | ARC, PAK | Full | DOS | Full support for all algorithms, including proprietary ones from PAK. Encryption only works in command-line utilities. |
| Ace | Only old files | DOS | No support for Ace 2.0 and up (WinAce). |
| Zoo | Full | DOS |
| | LZH | Full | DOS, Amiga (as LhA) |
| | ADF | FFS | Amiga (emulated) | Can extract files from Amiga disk images using the regular FFS file system. |
| DMS | FFS | Amiga | Can extract files from compressed Amiga disk images using the regular FFS file system. |
| LZX | Full | Amiga |
| | PowerPacker | Full | Amiga |
| | LBR | Full | CP/M, DOS |
| | Squeeze | Full | CP/M, DOS |
| | Crunch | Full | CP/M |
| | ... |
| | Many other old formats, especially Amiga-specific ones, are also supported through libxad, but I have not made a full survey of which ones. |

### Supported unusual formats
| Format | Support level | Notes |
|:-------|:--------------|:------|
| XAR | Full | Suggested replacement for Tar on Unix. Used in some newer .pkg files on Mac OS X. |
| RPM | Full | Linux package format. |
| ALZip | No encryption | Archive format which is mainly popular in South Korea. Support for all known compression methods, including Bzip2, Deflate and obfuscated Deflate. |
| NSA, SAR | Partial | Game data file. Can unpack all files I've found. If you have ones that do not unpack, please post an issue. |
| NDS | Full | Nintendo DS ROM image, which can contain a file system. |
| Zipx | Full | WinZip extended Zip files |

### Unsupported formats, for which support would be good to have
| Format | Notes | Issue number |
|:-------|:------|:-------------|
| Ace 2.0 | Proprietary, requires reverse engineering. | 58 |
| StuffIt X JPEG | Propietary, hugely complicated algorithm. Would require lots of reverse engineering. Supposedly patented, but I have been unable to locate the patent (which would contain useful information about the format). | 146 |
| DMG | Mac OS X disk images with a HFS+ filesystem. |
| | PAR | Not an archive format, but recovery records for missing archive parts. | 39 |
| SHK | Apple II archive format. | 119 |
| Amiga compressors | The Amiga had a lot of different single-file compressors. Support for more of these would be useful. libxfd supports many of them, but is mostly 68k only. |
| | Deb | Linux package format. |
|
3 changes: 3 additions & 0 deletions local.properties.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#test.arc=foo/bar.arc
#test.7z=foo/bar.7z
#test.sit=foo/bar.sit
Loading

0 comments on commit 84253f5

Please sign in to comment.