New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to leave base stream open when disposing #779
Comments
We shouldn't be disposing streams we didn't create. A lot of StreamReaders and whatnot do dispose. Please show what usage disposes unexpectedly |
Your implementation of |
Options "LeaveStreamOpen" true/false |
I am using ZlibStream directly, yes. And from what I can tell that's the only option in this library. Currently I made my own wrapper stream to avoid disposing, but I'd prefer if there was simply an option in the API directly like there is in the streams in the .NET libraries. There should be a difference between wanting to dispose the compression stream and whatever data it might be using and the base stream that you pass in. |
It can be a feature added, I think the compression streams directly haven't been changed to respond to that option |
Currently when disposing a compression stream such as
ZlibStream
it will also dispose the base stream you passed in. There are however times where you still want the base stream to remain open for further use and currently the only way I could find to do this is by creating a wrapping stream which doesn't dispose.My suggestion would be to do what most built-in .NET streams do and have a parameter in the constructor called
leaveOpen
which indicates if the base stream you pass in should be left open even after disposing.The text was updated successfully, but these errors were encountered: