commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grobme...@apache.org
Subject svn commit: r764503 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
Date Mon, 13 Apr 2009 15:20:25 GMT
Author: grobmeier
Date: Mon Apr 13 15:20:24 2009
New Revision: 764503

URL: http://svn.apache.org/viewvc?rev=764503&view=rev
Log:
COMPRESS-69: Applied patch from Uwe Schindler. Writing magic BZ is now done by the stream
again.
COMPRESS-69: Updated docs

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java?rev=764503&r1=764502&r2=764503&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
Mon Apr 13 15:20:24 2009
@@ -543,13 +543,7 @@
     /**
      * Constructs a new <tt>CBZip2OutputStream</tt> with a blocksize of 900k.
      *
-     * <p>
-     * <b>Attention: </b>The caller is resonsible to write the two BZip2 magic
-     * bytes <tt>"BZ"</tt> to the specified stream prior to calling this
-     * constructor.
-     * </p>
-     *
-     * @param out *
+     * @param out 
      *            the destination stream.
      *
      * @throws IOException
@@ -565,13 +559,6 @@
     /**
      * Constructs a new <tt>CBZip2OutputStream</tt> with specified blocksize.
      *
-     * <p>
-     * <b>Attention: </b>The caller is resonsible to write the two BZip2 magic
-     * bytes <tt>"BZ"</tt> to the specified stream prior to calling this
-     * constructor.
-     * </p>
-     *
-     *
      * @param out
      *            the destination stream.
      * @param blockSize
@@ -708,17 +695,19 @@
         }
     }
 
+    /**
+     * Writes magic bytes like BZ on the first position of the stream
+     * and bytes indiciating the file-format, which is 
+     * huffmanised, followed by a digit indicating blockSize100k.
+     * @throws IOException if the magic bytes could not been written
+     */
     private void init() throws IOException {
-        // write magic: done by caller who created this stream
-        // this.out.write('B');
-        // this.out.write('Z');
+        bsPutUByte('B');
+        bsPutUByte('Z');
 
         this.data = new Data(this.blockSize100k);
 
-        /*
-         * Write `magic' bytes h indicating file-format == huffmanised, followed
-         * by a digit indicating blockSize100k.
-         */
+        // huffmanised magic bytes
         bsPutUByte('h');
         bsPutUByte('0' + this.blockSize100k);
 



Mime
View raw message