Hi all https://issues.apache.org/jira/browse/COMPRESS-486 highlights a problem of the code inside the example package. The methods with stream or channel arguments create wrapper objects around said streams or channels and never close them. They don't close them because this in turn would close the passed in streams or channels - and that wouldn't seem right as the methods don't own them.
One approach I came up with is to add overloads with callbacks that receice the wrapper instance. See https://github.com/apache/commons-compress/commit/5b43a001d151cb7251476e347e19dce480575652 in a branch for what I mean. I toyed with the idea of returning the wrapper object from expand/create but this would still leave the resources unclosed if an exception occured while expanding/creating the archive. An alternative I see is to "simply" close the wrappers ourselves and document the methods will do so. If people need to keep their streams open they must decorate their stream/channel with some NoClose wrappers. Given this is example code I wouldn't feel too bad, even if it breaks backwards compatibility in a way. WDYT? Stefan --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org