Provides classes for reading and writing the JAR (Java ARchive) file format, which is based on the standard ZIP file format with an optional manifest file.

1 JarArchive

JarArchiver wraps a memory JarOutputStream. You can add any object convertibel to InputStream to it. Then, convert it to to a Blob holding the jar.

Copy
<script>

    var jar = new Ax.util.jar.JarArchive();
    jar.add("doc0.xml", "<xml>1</xml>");
    jar.add("doc1.xml", "<xml>2</xml>");
    jar.add("doc2.xml", "<xml>3</xml>");
    new Ax.io.File("/tmp/documents.jar").write(jar);

</script>

The following constructors are available (including any convertible to InputStream)

JSJarArchive(JSFile file)
JSJarArchive(JSBlob blob)
JSJarArchive(JDBCBlob blob)
JSJarArchive(String text)

1.1 Show contents

Show the contents of an existing jar file as a resultset.

Copy
<script>

    var jar = new Ax.util.jar.JarArchive(new Ax.io.File("/tmp/documents.jar"))

    console.log(jar.toResultSet());

</script>
+--------+------+------------------------+
|<null>  |<null>|<null>                  |
|name    |size  |last_modified           |
|char(0) |long  |datetime                |
+--------+------+------------------------+
|doc0.xml|    -1|Dec 19, 2019, 5:34:34 PM|
|doc1.xml|    -1|Dec 19, 2019, 5:34:34 PM|
|doc2.xml|    -1|Dec 19, 2019, 5:34:34 PM|
+--------+------+------------------------+