Giter Site home page Giter Site logo

xar's Introduction

xar for Java

A Java library for reading and writing eXtensible ARchiver files by sprylab technologies GmbH.

Work-in-progress note

This is the public preview version. It works for us, but it still has some rough corners and thus lacks consistent code style, sufficient unit tests and complete documentation. Especially the writing support is still experimental.

Use with care! We work on a fully polished version 1.0.0 and will release it, when it's done.

Thanks for your patience!

Usage

Open a .xar file:

XarSource xar = new FileXarSource(new File("my-file.xar"));

Open a .xar file from URL (needs xar-http module):

XarSource xar = new HttpXarSource("https://example.com/files/my-file.xar");

Extract a .xar file:

xar.extractAll(new File("extract-directory"));

Get a list of all entries:

List<XarEntry> entries = xar.getEntries();

Get a specific entry:

XarEntry entry = xar.getEntry("directory/file.txt");

Stream, extract or get bytes of a entry:

InputStream inputStream = entry.getInputStream();
entry.extract(new File("extract-directory"));
byte[] bytes = entry.getBytes();

Create a .xar file from directory:

XarPacker xarPacker = new XarPacker(new File("my-file.xar"));
xarPacker.addDirectory(new File("directory"), false, null));
xarPacker.write();

Download

Download the latest JAR or grab via Maven:

<dependency>
  <groupId>com.sprylab.xar</groupId>
  <artifactId>xar</artifactId>
  <version>0.9.9</version>
</dependency>

or Gradle:

compile 'com.sprylab.xar:xar:0.9.9'

If you need to access files via HTTP, add the xar-http module as a dependency, too:

<dependency>
  <groupId>com.sprylab.xar</groupId>
  <artifactId>xar-http</artifactId>
  <version>0.9.9</version>
</dependency>

or Gradle:

compile 'com.sprylab.xar:xar-http:0.9.9'

There is also a CLI version, which mimics the behavior of the original C executable. Download the latest standalone-JAR (all dependencies included) for direct use at the command line.

License

Copyright 2013-2018 sprylab technologies GmbH

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Related projects

Original C source: http://code.google.com/p/xar/

Fork/clone by @mackyle: https://github.com/mackyle/xar

JavaScript port by @finnp: https://github.com/finnp/xar

xar's People

Contributors

hameno avatar andyglick avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.