XAR Project Root

A Java library for working with XAR archives.

License

License

GroupId

GroupId

com.github.gino0631
ArtifactId

ArtifactId

xar-root
Last Version

Last Version

1.1
Release Date

Release Date

Type

Type

pom
Description

Description

XAR Project Root
A Java library for working with XAR archives.
Project URL

Project URL

https://github.com/gino0631/xar
Source Code Management

Source Code Management

https://github.com/gino0631/xar

Download xar-root

Filename Size
xar-root-1.1.pom 5 KB
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.gino0631/xar-root/ -->
<dependency>
    <groupId>com.github.gino0631</groupId>
    <artifactId>xar-root</artifactId>
    <version>1.1</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.gino0631/xar-root/
implementation 'com.github.gino0631:xar-root:1.1'
// https://jarcasting.com/artifacts/com.github.gino0631/xar-root/
implementation ("com.github.gino0631:xar-root:1.1")
'com.github.gino0631:xar-root:pom:1.1'
<dependency org="com.github.gino0631" name="xar-root" rev="1.1">
  <artifact name="xar-root" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.github.gino0631', module='xar-root', version='1.1')
)
libraryDependencies += "com.github.gino0631" % "xar-root" % "1.1"
[com.github.gino0631/xar-root "1.1"]

Dependencies

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

  • xar-api
  • xar-core

XAR

Build Status Maven Central

A Java library for working with XAR archives. It supports both reading and creation of archives, with optional signing and time stamping.

Requirements

  • Java 8

Usage

The first step is to add a dependency on com.github.gino0631:xar-core to your project, for example, if using Maven:

<dependency>
  <groupId>com.github.gino0631</groupId>
  <artifactId>xar-core</artifactId>
  <version>...</version>
</dependency>

Interfaces for public use are contained in com.github.gino0631.xar and its subpackages, except for impl and spi.

To read an archive, load it using XarArchive.load():

try (XarArchive xar = XarArchive.load(...) {
  XarArchive.Header header = xar.getHeader();
  ...

  List<XarArchive.Entry> entries = xar.getEntries();
  ...
}

To create an archive, use XarBuilder:

try (XarBuilder xarBuilder = XarBuilder.getInstance()) {
  XarBuilder.Container root = xarBuilder.getRoot();
  XarBuilder.File file = root.addFile("file.txt", EncodingAlgorithm.ZLIB, Files.newInputStream(...));
  
  XarBuilder.Directory dir = root.addDirectory("dir");
  dir.addFile(...);
  ...

  try (XarArchive xar = xarBuilder.build()) {
    xar.writeTo(...);
  }
}

If signing is required, set private key, certificates, and provider (if required) before building:

xarBuilder.setSigning(privateKey, certificates, provider);

or, to sign and then to time stamp the signature:

xarBuilder.setSigning(privateKey, certificates, provider, tsa);

Versions

Version
1.1
1.0