summaryrefslogtreecommitdiff
path: root/java-compat/src
diff options
context:
space:
mode:
Diffstat (limited to 'java-compat/src')
-rw-r--r--java-compat/src/Ice/src/main/java/IceInternal/BZip2.java23
1 files changed, 2 insertions, 21 deletions
diff --git a/java-compat/src/Ice/src/main/java/IceInternal/BZip2.java b/java-compat/src/Ice/src/main/java/IceInternal/BZip2.java
index 7cb4ccee92f..c80c5f4eb80 100644
--- a/java-compat/src/Ice/src/main/java/IceInternal/BZip2.java
+++ b/java-compat/src/Ice/src/main/java/IceInternal/BZip2.java
@@ -43,17 +43,11 @@ public class BZip2
try
{
//
- // Compress the data using the class org.apache.tools.bzip2.CBZip2OutputStream.
+ // Compress the data using the class org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream.
// Its constructor requires an OutputStream argument, therefore we pass the
// compressed buffer in an OutputStream wrapper.
//
BufferedOutputStream bos = new BufferedOutputStream(compressed);
- //
- // For interoperability with the bzip2 C library, we insert the magic bytes
- // 'B', 'Z' before invoking the Java implementation.
- //
- bos.write('B');
- bos.write('Z');
java.lang.Object[] args = new java.lang.Object[]{ bos, Integer.valueOf(compressionLevel) };
java.io.OutputStream os = (java.io.OutputStream)_bzOutputStreamCtor.newInstance(args);
os.write(data, offset + headerSize, uncompressedLen);
@@ -140,25 +134,12 @@ public class BZip2
try
{
//
- // Uncompress the data using the class org.apache.tools.bzip2.CBZip2InputStream.
+ // Uncompress the data using the class org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.
// Its constructor requires an InputStream argument, therefore we pass the
// compressed data in a ByteArrayInputStream.
//
java.io.ByteArrayInputStream bais =
new java.io.ByteArrayInputStream(compressed, offset + headerSize + 4, compressedLen);
- //
- // For interoperability with the bzip2 C library, we insert the magic bytes
- // 'B', 'Z' during compression and therefore must extract them before we
- // invoke the Java implementation.
- //
- byte magicB = (byte)bais.read();
- byte magicZ = (byte)bais.read();
- if(magicB != (byte)'B' || magicZ != (byte)'Z')
- {
- Ice.CompressionException e = new Ice.CompressionException();
- e.reason = "bzip2 uncompression failure: invalid magic bytes";
- throw e;
- }
java.lang.Object[] args = new java.lang.Object[]{ bais };
java.io.InputStream is = (java.io.InputStream)_bzInputStreamCtor.newInstance(args);
r.b.position(headerSize);