Commons Compress
  1. Commons Compress
  2. COMPRESS-37

Create a finish() method similar to the java.util.zip.GZIPOutputStream#finish()

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0
    • Component/s: None
    • Labels:
      None

      Description

      In order to write mixed (compressed/not comressed) data into an output stream it would be helpful if the CBZip2OutputStream would implement a finish() method, which is almost the same as the close() method but does not close the underlying output stream, so that writing to this stream can be continued.

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        573d 5h 18m 1 Torsten Curdt 12/Jan/09 11:33
        Resolved Resolved Closed Closed
        456d 9h 8m 1 Torsten Curdt 13/Apr/10 20:42
        Torsten Curdt made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Stefan Bodewig made changes -
        Fix Version/s 1.0 [ 12313768 ]
        Dennis Lundberg made changes -
        Project Commons Sandbox [ 12310491 ] Commons Compress [ 12310904 ]
        Key SANDBOX-194 COMPRESS-37
        Component/s Compress [ 12311183 ]
        Torsten Curdt made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Torsten Curdt [ tcurdt ]
        Resolution Fixed [ 1 ]
        Hide
        Torsten Curdt added a comment -

        got a seperate finish() method now. In order to not close the stream you should wrap the stream in a delegating NonClosingOutputStream and you are good to go.

        Show
        Torsten Curdt added a comment - got a seperate finish() method now. In order to not close the stream you should wrap the stream in a delegating NonClosingOutputStream and you are good to go.
        Hide
        Emmanuel Bourg added a comment -
        Show
        Emmanuel Bourg added a comment - Related to this Ant issue : https://issues.apache.org/bugzilla/show_bug.cgi?id=42713
        Stefan Liebig made changes -
        Field Original Value New Value
        Component/s Compress [ 12311183 ]
        Hide
        Stefan Liebig added a comment -

        Patch:

        boolean closed = false;
        boolean finished = false;

        protected void finalize() throws Throwable

        { close(); super.finalize(); }

        /**

        • Finishes writing compressed data to the output stream without closing the underlying stream.
        • Use this method when applying multiple filters in succession to the same output stream.
        • @throws IOException
          */
          public void finish() throws IOException {
          if ( finished ) { return; }

          if ( runLength > 0 ) { writeRun(); }
          currentChar = -1;
          endBlock();
          endCompression();
          flush();
          finished = true;
          }

          public void close() throws IOException {
          if ( closed ) { return; }

        finish();
        closed = true;
        super.close();
        bsStream.close();
        }

        Show
        Stefan Liebig added a comment - Patch: boolean closed = false; boolean finished = false; protected void finalize() throws Throwable { close(); super.finalize(); } /** Finishes writing compressed data to the output stream without closing the underlying stream. Use this method when applying multiple filters in succession to the same output stream. @throws IOException */ public void finish() throws IOException { if ( finished ) { return; } if ( runLength > 0 ) { writeRun(); } currentChar = -1; endBlock(); endCompression(); flush(); finished = true; } public void close() throws IOException { if ( closed ) { return; } finish(); closed = true; super.close(); bsStream.close(); }
        Stefan Liebig created issue -

          People

          • Assignee:
            Torsten Curdt
            Reporter:
            Stefan Liebig
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development