diff --git a/build.xml b/build.xml
index 4aeea82..639e512 100644
--- a/build.xml
+++ b/build.xml
@@ -5,6 +5,7 @@
+
diff --git a/cfg/drivers-all.xml b/cfg/drivers-all.xml
index 241c450..7f0146f 100644
--- a/cfg/drivers-all.xml
+++ b/cfg/drivers-all.xml
@@ -10,6 +10,12 @@
xmlns="http://www.sun.com/japex/testSuite"
xmlns:xi="http://www.w3.org/2001/XInclude"
>
+
+
+
+
+
+
@@ -77,7 +83,7 @@
-
+
diff --git a/lib/lzma-java/lzma-java-1.3-SNAPSHOT.jar b/lib/lzma-java/lzma-java-1.3-SNAPSHOT.jar
new file mode 100644
index 0000000..cff9843
Binary files /dev/null and b/lib/lzma-java/lzma-java-1.3-SNAPSHOT.jar differ
diff --git a/src/main/java/com/ning/jcbm/bzip2/BZip2Driver.java b/src/main/java/com/ning/jcbm/bzip2/BZip2Driver.java
index 147db6b..9a53e5e 100644
--- a/src/main/java/com/ning/jcbm/bzip2/BZip2Driver.java
+++ b/src/main/java/com/ning/jcbm/bzip2/BZip2Driver.java
@@ -44,5 +44,4 @@ protected int uncompressFromStream(InputStream compIn, byte[] inputBuffer) throw
}
return total;
}
-
}
diff --git a/src/main/java/com/ning/jcbm/lzma/LzmaDriver.java b/src/main/java/com/ning/jcbm/lzma/LzmaDriver.java
index 1e8e302..385c57c 100644
--- a/src/main/java/com/ning/jcbm/lzma/LzmaDriver.java
+++ b/src/main/java/com/ning/jcbm/lzma/LzmaDriver.java
@@ -4,6 +4,10 @@
import com.ning.jcbm.DriverBase;
+/**
+ * Driver that uses original conversion done by LZMA author.
+ * Codec is not supported any more (AFAIK).
+ */
public class LzmaDriver extends DriverBase
{
static final int DEFAULT_ALGORITHM = 2;
diff --git a/src/main/java/com/ning/jcbm/lzma/LzmaJavaDriver.java b/src/main/java/com/ning/jcbm/lzma/LzmaJavaDriver.java
new file mode 100644
index 0000000..cf25440
--- /dev/null
+++ b/src/main/java/com/ning/jcbm/lzma/LzmaJavaDriver.java
@@ -0,0 +1,71 @@
+package com.ning.jcbm.lzma;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import lzma.streams.LzmaInputStream;
+import lzma.streams.LzmaOutputStream;
+import lzma.sdk.lzma.Decoder;
+
+import com.ning.jcbm.DriverBase;
+
+/**
+ * Driver for more up-to-date LZMA codec from
+ * [https://github.com/jponge/lzma-java].
+ * Project is active, code maintained.
+ */
+public class LzmaJavaDriver extends DriverBase
+{
+ public LzmaJavaDriver() {
+ super("LZMA-java");
+ }
+
+ // No native Block API; but need some impl for test framework
+
+ protected byte[] compressBlock(byte[] uncompressed) throws IOException {
+ return compressBlockUsingStream(uncompressed);
+ }
+
+ protected byte[] uncompressBlock(byte[] compressed) throws IOException {
+ return uncompressBlockUsingStream(
+ new LzmaInputStream(new ByteArrayInputStream(compressed), getDecoder()));
+ }
+
+ protected void compressToStream(byte[] uncompressed, OutputStream rawOut) throws IOException
+ {
+ LzmaOutputStream compressedOut = new LzmaOutputStream.Builder(
+ // do we really need compressed stream here? probably not, it's ByteArrayOutputStream
+ //new BufferedOutputStream(new FileOutputStream(compressed)))
+ rawOut)
+ // how about other settings? are defaults ok?
+ /*
+ .useMaximalDictionarySize()
+ .useEndMarkerMode(true)
+ .useBT4MatchFinder()
+ */
+ .build();
+ compressedOut.write(uncompressed);
+ compressedOut.close();
+ }
+
+ protected int uncompressFromStream(InputStream compIn, byte[] inputBuffer) throws IOException
+ {
+ // as above, we get a ByteArrayInputStream so no buffering needed:
+ // (but would reuse of Decoder help?)
+ LzmaInputStream compressedIn = new LzmaInputStream(compIn, getDecoder());
+
+ int total = 0;
+ int count;
+
+ while ((count = compressedIn.read(inputBuffer)) >= 0) {
+ total += count;
+ }
+ return total;
+ }
+
+ protected Decoder getDecoder() {
+ return new Decoder();
+ }
+}