diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/src/Ice/src/main/java/com/zeroc/IceInternal/BZip2.java | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/BZip2.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/BZip2.java index bb1b0b41f85..3d60cc65702 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/BZip2.java +++ b/java/src/Ice/src/main/java/com/zeroc/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,13 @@ 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') - { - com.zeroc.Ice.CompressionException e = new com.zeroc.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); |