ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 42713] - CBZip2OutputStream#finish method like in java.util.zip.GZIPOutputStream
Date Fri, 22 Jun 2007 09:12:05 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42713>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42713





------- Additional Comments From Stefan.Liebig@compeople.de  2007-06-22 02:12 -------
Proposed patch:
 - finish added
 - close and finalize changed
------------------------------------------------------------------------------
	/**
	 * Finishes compressing to the underlying stream without closing it,
	 * so that multiple compressors can write subsequently to the same
	 * output stream.
	 *  
	 * @throws IOException
	 */
	public void finish() throws IOException {
		OutputStream outShadow = this.out;
		if ( outShadow != null && this.data != null ) {
			try {
				if ( this.runLength > 0 ) {
					writeRun();
				}
				this.currentChar = -1;
				endBlock();
				endCompression();
				//				outShadow.close();
			} finally {
				//				this.out = null;
				this.data = null;
			}
		}
	}

	/**
	 * Overriden to close the stream.
	 */
	protected void finalize() throws Throwable {
		if ( this.data != null ) {
			close();
			super.finalize();
		}
	}

	public void close() throws IOException {
		finish();
		OutputStream outShadow = this.out;
		if ( outShadow != null ) {
			try {
				outShadow.close();
			} finally {
				this.out = null;
			}
		}

		//		OutputStream outShadow = this.out;
		//		if ( outShadow != null ) {
		//			try {
		//				if ( this.runLength > 0 ) {
		//					writeRun();
		//				}
		//				this.currentChar = -1;
		//				endBlock();
		//				endCompression();
		//				outShadow.close();
		//			} finally {
		//				this.out = null;
		//				this.data = null;
		//			}
		//		}
	}


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message