Java has a notion of separate InputStreams and OutputStreams. Your code reads from an InputStream and writes to an OutputStream.
.NET does not have this distinction, instead it has a single Stream class which your code can both write to and read from, depending on the exact implementation. Capabilities can be determined by the CanRead and CanWrite properties.
I'm wondering if there's a fundamental benefit to one approach over the other? All I can come up with is:
- Code is potentially slightly more concise with a single Stream if you're both reading and writing
closemethod could be particularly confusing or even dangerous if using separate input and output stream classes which are working with the same underlying stream
- Separate input and output stream classes make the intention of the code clearer
None of these reasons seems particularly compelling to me. Are there any more compelling reasons I'm missing?