Skip to content

Commit

Permalink
Merge pull request #19 from umjammer/1.1.2
Browse files Browse the repository at this point in the history
1.1.2
  • Loading branch information
umjammer authored Feb 6, 2024
2 parents fec6925 + eb4d0cf commit 2856115
Show file tree
Hide file tree
Showing 69 changed files with 484 additions and 451 deletions.
25 changes: 11 additions & 14 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
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.
Expand All @@ -53,8 +44,12 @@ jobs:

# 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: Autobuild
uses: github/codeql-action/autobuild@v1
- 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
Expand All @@ -66,6 +61,8 @@ jobs:
#- 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@v1
uses: github/codeql-action/analyze@v2
27 changes: 17 additions & 10 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven
name: Java CI

on:
push:
Expand All @@ -15,12 +15,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- 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: mvn -B package --file pom.xml
74 changes: 45 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,64 @@
[![](https://jitpack.io/v/umjammer/vavi-util-archive.svg)](https://jitpack.io/#umjammer/vavi-util-archive)
[![Java CI with Maven](https://github.com/umjammer/vavi-util-archive-sandbox/workflows/Java%20CI%20with%20Maven/badge.svg)](https://github.com/umjammer/vavi-util-archive-sandbox/actions)
[![CodeQL](https://github.com/umjammer/vavi-util-archive/workflows/CodeQL/badge.svg)](https://github.com/umjammer/vavi-util-archive-sandbox/actions)
![Java](https://img.shields.io/badge/Java-8-b07219)
![Java](https://img.shields.io/badge/Java-17-b07219)

# vavi-util-archive

🌏 Extract the world!

extract all archive types in the same way!</br>
archives are able to mount as fuse also using [vavi-nio-file-archive](https://github.com/umjammer/vavi-apps-fuse/tree/master/vavi-nio-file-archive)
and [vavi-net-fuse](https://github.com/umjammer/vavi-apps-fuse/tree/master/vavi-net-fuse)

## Status

| name | mathod | read | write | comment | library |
|----------|-----------|--------|--------|---------|-------------------------------------------------------------------------|
| binhex | archiving || - | | [binhex](https://github.com/umjammer/JBinHex) |
| bzip2 | archiving || - | | [commons-compress](https://commons.apache.org/proper/commons-compress/) |
| cab | archiving || - | | [dorkbox](https://github.com/umjammer/CabParser) |
| gca | archiving | - | - | win only | native |
| gca | archiving | - | - | | shell |
| gzip | archiving || - | | jdk |
| lha | archiving || - | | [lha](https://github.com/umjammer/jlha) |
| rar | archiving | - | - | win only | native |
| rar | archiving | - | - | | shell |
| rar | archiving || - | | [java-unrar](https://github.com/umjammer/java-unrar) |
| rar | archiving || - | no rar5 | [junrar](https://github.com/junrar/junrar) |
| sevenzip | archiving || - | 7z only | [commons-compress](https://commons.apache.org/proper/commons-compress/) |
| sevenzip | archiving | - | - | | native |
| stuffit | archiving | | - | | native |
| tar | archiving || - | | [commons-compress](https://commons.apache.org/proper/commons-compress/) |
| tar | stream || - | | [commons-compress](https://commons.apache.org/proper/commons-compress/) |
| zip | archiving || - | | jdk |
| zip | archiving || - | | [ant](https://ant.apache.org/) |
| cpio | stream | 🚧 | - | | gjt |
| lzma | stream | 🚧 | - | | [p7zip](https://p7zip.sourceforge.net/) |
| rpm | archiving | 🚧 | - | | gjt |
| apache | archiving || - | multi | [commons-compress](https://commons.apache.org/proper/commons-compress/) |
| name | mathod | read | write | comment | library |
|----------|-----------|------|--------|---------|-------------------------------------------------------------------------|
| binhex | archiving || - | | [binhex](https://github.com/umjammer/JBinHex) |
| bzip2 | archiving || - | | [commons-compress](https://commons.apache.org/proper/commons-compress/) |
| cab | archiving || - | | [dorkbox](https://github.com/umjammer/CabParser) |
| gca | archiving | - | - | win only | native |
| gca | archiving | - | - | | shell |
| gzip | archiving || - | | jdk |
| lha | archiving || - | | [lha](https://github.com/umjammer/jlha) |
| rar | archiving | - | - | win only | native |
| rar | archiving | - | - | | shell |
| rar | archiving |* | - | | [java-unrar](https://github.com/umjammer/java-unrar) |
| rar | archiving || - | no rar5 | [junrar](https://github.com/junrar/junrar) |
| sevenzip | archiving || - | 7z only | [commons-compress](https://commons.apache.org/proper/commons-compress/) |
| sevenzip | archiving | - | - | | native |
| stuffit | archiving | | - | | native |
| tar | archiving || - | | [commons-compress](https://commons.apache.org/proper/commons-compress/) |
| tar | stream || - | | [commons-compress](https://commons.apache.org/proper/commons-compress/) |
| zip | archiving |* | - | | jdk |
| zip | archiving || - | | [ant](https://ant.apache.org/) |
| cpio | stream | 🚧 | - | | gjt |
| lzma | stream | 🚧 | - | | [p7zip](https://p7zip.sourceforge.net/) |
| rpm | archiving | 🚧 | - | | gjt |
| apache | archiving || - | multi | [commons-compress](https://commons.apache.org/proper/commons-compress/) |

<sub>* chosen as spi</sub>

## Usage

### archive extraction

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

### archive decompression

```java
InputStream compressed = Archives.getInputStream(Paths.get("foo/bar.tar.bz").toFile());
Files.copy(compressed, Paths.get("foo/bar.tar"));
```

## License

* [Giant Java Tree/cpio](http://www.gjt.org/servlets/JCVSlet/list/gjt/org/gjt/archive/cpio) ... Unknown
Expand All @@ -57,17 +68,22 @@ and [vavi-net-fuse](https://github.com/umjammer/vavi-apps-fuse/tree/master/vavi-

## TODO

* registory like IIORegistory
* [commons-vfs](https://commons.apache.org/proper/commons-vfs/)
* [truevfs](https://github.com/christian-schlichtherle/truevfs)
* ~~apache commons-compress~~
* https://github.com/ZIPmagic/ZIPmagic/tree/master/StuffIt%20SDK
* ~~https://github.com/cstroe/SevenZip-Java~~ (use 7zip-jbinding)
* write!
* ~~jar5~~ (done by 7zip-jbinding)
* ~~rar5~~ (done by 7zip-jbinding)
* ~~[@marcusvoltolim]((https://github.com/marcusvoltolim/file-processor#readme)) says [sevenzipjbinding](https://github.com/borisbrodski/sevenzipjbinding) can deal rar5 ???~~
* it's [true](https://github.com/borisbrodski/sevenzipjbinding/issues/19#issuecomment-578636772)
* unar v1.10.7 ... ok
* 7zip 17.04 ... ok
* https://github.com/prog-ai/ArchivR (wip)
* ~~https://github.com/Diab1o/java-7z-archiver ... yet another pure java 7zip implementation?~~ (done)
* where is my jna 7z implementation? (in the crashed hdd?)
* where is my jna 7z implementation? (in the crashed hdd?)
* binary things ... gca.exe -> dll -> 64bit -> mach-O + winelib -> dylib
* https://github.com/gitGNU/objconv
* https://github.com/jakeajames/dylibify
* https://github.com/hasherezade/exe_to_dll
2 changes: 2 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jdk:
- openjdk17
2 changes: 2 additions & 0 deletions local.properties.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#archive.zip.file1=/foo/bar.zip
#archive.rar.file=/foo/bar.rar
63 changes: 44 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@

<groupId>vavi</groupId>
<artifactId>vavi-util-archive</artifactId>
<version>1.1.1</version>
<version>1.1.2</version>

<name>Vavi Archiving API</name>
<name>Vavi Archiving SPI</name>
<url>https://github.com/umjammer/vavi-util-archive</url>
<description>
TOOD

jni on maven
registory like IIORegistory</description>
<description>Vavi Archiving SPI and implementations</description>
<scm>
<url>https://github.com/umjammer/vavi-util-archive</url>
</scm>
Expand All @@ -29,11 +25,9 @@ TOOD
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.11.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<release>17</release>
</configuration>
</plugin>
<plugin>
Expand All @@ -56,7 +50,7 @@ TOOD
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<version>3.2.2</version>
<configuration>
<argLine>-Djava.util.logging.config.file=src/test/resources/logging.properties</argLine>
<trimStackTrace>false</trimStackTrace>
Expand All @@ -77,7 +71,7 @@ TOOD
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.9.0</version>
<version>5.10.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -88,12 +82,12 @@ TOOD
<dependency>
<groupId>com.github.umjammer</groupId>
<artifactId>vavi-commons</artifactId>
<version>1.1.7</version>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>com.github.umjammer</groupId>
<artifactId>jlha</artifactId>
<version>0.0.9</version>
<version>0.0.10</version>
</dependency>
<dependency>
<groupId>com.github.umjammer</groupId>
Expand All @@ -111,15 +105,14 @@ TOOD
<version>1.9</version>
</dependency>
<dependency>
<!-- de.innosystec, com.github.umjammer -->
<groupId>com.github.umjammer</groupId>
<groupId>com.github.umjammer</groupId> <!-- de.innosystec / com.github.umjammer -->
<artifactId>java-unrar</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>com.github.junrar</groupId>
<artifactId>junrar</artifactId>
<version>7.5.3</version>
<version>7.5.4</version>
</dependency>
<dependency>
<groupId>com.github.umjammer</groupId>
Expand All @@ -129,7 +122,7 @@ TOOD
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.12</version>
<version>1.10.13</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -160,4 +153,36 @@ TOOD
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<!-- mvn -P list antrun:run -Darchive='archive' -->
<id>list</id>
<build>
<plugins>
<plugin>
<!-- GOOD: fork: OK, test jars: OK, user args, default args: OK -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<java classname="vavi.util.archive.ArchivesMain" fork="true">
<classpath>
<path refid="maven.compile.classpath"/>
<path refid="maven.test.classpath"/>
</classpath>
<jvmarg value="-Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties" />
<arg value="${archive}" />
</java>
</target>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
3 changes: 1 addition & 2 deletions src/main/java/vavi/util/archive/Archives.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.logging.Level;

import vavi.util.Debug;
import vavi.util.StringUtil;
import vavi.util.archive.spi.ArchiveSpi;
import vavi.util.archive.spi.InputStreamSpi;

Expand Down Expand Up @@ -52,7 +51,7 @@ public static InputStream getInputStream(InputStream is) throws IOException {
InputStream bis = new BufferedInputStream(is);

for (InputStreamSpi inputStreamSpi : inputStreamSpis) {
Debug.println(Level.FINE, "inputStreamSpi: " + StringUtil.getClassName(inputStreamSpi.getClass()));
Debug.println(Level.FINE, "inputStreamSpi: " + inputStreamSpi.getClass().getSimpleName());
if (inputStreamSpi.canExpandInput(bis)) {
InputStream inputStream = inputStreamSpi.createInputStreamInstance();
Debug.println(Level.FINE, "inputStream: " + inputStream.getClass());
Expand Down
Loading

0 comments on commit 2856115

Please sign in to comment.