Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
org.glavo.kala:kala-compress-archivers-ar
Advanced tools
This project is based on Apache Commons Compress. Kala Compress has made some improvements on its basis: Modularization (JPMS Support), NIO2 Path API support, etc.
Its API is mostly consistent with Apache Commons Compress, with a few incompatibilities.
So I renamed the package (and the module name) from org.apache.commons.compress
to kala.compress
.
Therefore, it can coexist with Apache Commons Compress without conflict.
We assume that you already know about Commons Compress. If not, please refer to the User Guide first.
To add Kala Compress as a dependency, see section Modules.
Kala Compress has been fully modularized and now fully supports the the JPMS (Java Platform Module System).
Each compressor and archive is split into a separate artifact with a separate module name, you can optionally add dependencies on some of them without importing the entire Kala Compress. (The size of Kala Compress core jar is less than 90KB)
The appearance of ArchiveStreamFactory
and CompressorStreamFactory
has not changed,
but the inside has been remodeled to find the optional component through ServiceLoader
at runtime,
so they are no longer dependent on them at compile time.
Each module provides its module-info.class
, so it can work well with jlink
.
For more information about the Kala Compress modules, see Modules.
Kala Compress has been completely refactored internally to use java.nio.charset.Charset
to represent encoding.
All methods that accept an encoding represented by String provide overloads that accept Charset
, please use Charset
first.
ZipEncoding
has been removed, please switch to Charset
.
CharsetNames
has been removed, please switch to StandardCharsets
.
Kala Compress no longer uses Charset.defaultCharset()
, but uses UTF-8 as an alternative.
Note that file.encoding
defaults to UTF-8 since Java 18. When you want to use platform native encoding,
use the kala.compress.utils.Charsets.nativeCharset()
explicitly as an alternative.
In addition, APIs that accept encoding represented by String
now no longer fall back to the default character set when the encoding is not supported or invalid.
Now they throw exceptions just like Charset.forName
. (The behavior when null
is passed in is not affected, it will still fall back to the UTF-8)
java.nio.file.Path
and java.nio.file.FileSystem
)Based on the Commons Compress 1.21, Kala Compress has better support for the NIO2 Path API.
Internally, Kala Compress has switched entirely to Path-based representation,
all methods that accept File
provide overloads that accept Path
.
The original File
-based API is now delegated to the Path-based API. Please use the Path
-based API first.
Since File
is no longer used internally, Kala Compress fully supports Path
s on non default file systems.
(TODO: Provide FileSystem
implementations for each archivers)
The deprecated features in Apache Commons Compress 1.21 have all been removed.
Additional support for OSGI is no longer provided, but this shouldn't make a big difference.
If the problem is caused by caching of dependency checks, use the corresponding setCache[Library]Availablity
to turn off its caching.
ZipEncoding
and CharsetNames
has been removed, please switch to Charset
and StandardCharsets
.
Since Security Manager will be removed from JDK in the future, Kala Compress no longer use it. For more details, see JEP 411: Deprecate the Security Manager for Removal.
Since finalize
method will be removed from JDK in the future, Kala Compress no longer used to clean up resources.
For more details, see JEP 421: Deprecate Finalization for Removal.
The archiveName
in the ZipFile
constructor is only used for error reporting in finalize
, so it is removed together.
The implementation of pack200 was removed, kala.compress.compressors.pack200
now uses a more flexible reflection strategy to select the underlying implementation:
java.util.jar.Pack200
built into the JDK,
so it doesn't need external dependencies at this time.org.glavo.pack200.Pack200
(extracted from JDK 13 and published separately)org.apache.commons.compress.java.util.jar.Pack200
(available in Apache Commons Compress 1.21)io.pack200.Pack200
Pack200Utils.setPack200Provider(String provider)
to specify specific implementations to use, including those not in the list above.A small number of methods that accept the File
and accept encoding represented by String
have been removed.
Please use Path
and Charset
instead.
Note: Kala Compress is in beta phase. Although it is developed based on mature Apache Commons Compress and has passed all tests, it may still be unstable. I may need to make some adjustments to the API before releasing to production.
The latest Kala Compress version is 1.21.0.1-beta2
.
You can add dependencies on Kala Compress modules as follows:
Maven:
<dependency>
<groupId>org.glavo.kala</groupId>
<artifactId>${kala-compress-module-name}</artifactId>
<version>${kala-compress-version}</version>
</dependency>
Gradle:
dependencies {
implementation("org.glavo.kala:${kala-compress-module-name}:${kala-compress-version}")
}
Replace the ${kala-compress-module-name}
with Kala Compress Maven module name (replace .
with -
in JPMS module name),
replace the ${kala-compress-version}
with the latest Kala Compress version.
For example, to add the entire Kala Compress, you need to add the following:
Maven:
<dependency>
<groupId>org.glavo.kala</groupId>
<artifactId>kala-compress</artifactId>
<version>1.21.0.1-beta2</version>
</dependency>
Gradle:
dependencies {
implementation("org.glavo.kala:kala-compress:1.21.0.1-beta2")
}
All Kala Compress modules are listed below.
kala.compress
This is an empty module, which declares the transitivity dependency on all modules of Kala Compress. You can use all the contents of Kala Compress only by adding dependencies on it.
kala.compress.base
It is the basic module of Kala Compress, and all other modules depend on it.
It contains the following packages:
kala.compress
kala.compress.archivers
kala.compress.compressors
kala.compress.compressors.lz77support
kala.compress.compressors.lzw
kala.compress.compressors.parallel
kala.compress.compressors.utils
kala.compress.compressors
It is an empty module that contains transitive dependencies on all compressor modules. You can include all compressors by adding a dependency on it.
In addition, each compressor in Kala Compress has a separate module, and you can add dependencies on one or all of them separately. Here is a list of compressors:
kala.compress.compressors.brotli
kala.compress.compressors.bzip2
kala.compress.compressors.deflate
kala.compress.compressors.deflate64
kala.compress.compressors.gzip
kala.compress.compressors.lz4
kala.compress.compressors.lzma
kala.compress.compressors.pack200
kala.compress.compressors.snappy
kala.compress.compressors.xz
kala.compress.compressors.z
kala.compress.compressors.zstandard
Here are some notes:
brotli
compressor has no external dependencies.
It copies the Google Brotli code into package kala.compress.compressors.brotli.dec
,
The reason for this is that Google Brotli does not support JPMS.lzma
compressor and the xz
compressor needs XZ for Java to work.zstandard
compressor needs Zstd JNI to work.kala.compress.archivers
It is an empty module that contains transitive dependencies on all archiver modules. You can include all archivers by adding a dependency on it.
In addition, each archiver in Kala Compress has a separate module, and you can add dependencies on one or all of them separately. Here is a list of archivers:
kala.compress.archivers.ar
kala.compress.archivers.arj
kala.compress.archivers.cpio
kala.compress.archivers.dump
kala.compress.archivers.sevenz
kala.compress.archivers.tar
kala.compress.archivers.zip
Here are some notes:
sevenz
archiver needs XZ for Java to work.sevenz
archiver and the zip
archiver have optional dependencies on the bzip2
compressor and the deflate64
compressor.
They can work without these compressors, but errors will occur when they are required.jar
(in package kala.compress.archivers.jar
) is in the module kala.compress.archivers.zip
.kala.compress.changes
It contains the package kala.compress.changes
.
ZipEncoding
and CharsetNames
, replace them with Charset
, StandardCharsets
and Charsets
;Charset
, allows users to specify encoding without using String
at all;File
to Path
;FileSystem
for each archiver;CompressorStreamFactory
ArchiveStreamFactory
If you encounter problems using it, please open an issue.
If it's an issue upstream of Apache Commons Compress, it's best to give feedback here and I'll port the upstream fix here.
FAQs
Unknown package
We found that org.glavo.kala:kala-compress-archivers-ar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.