Sunday, January 23, 2011

How should I handle third-party input/output streams?

Programmer Question

Hi all!



There is a piece of project dealing mostly with input/output streams. So I have to pass streams as arguments and receive them from third-party libraries. I've read Good design: How to pass InputStreams as argument? and Closing Java InputStreams, but I'm not 100% sure that third-parties are sharing the same coding values and following best designs patterns (in particular - "the one who opens the stream should close the stream")



Assuming that streams are pretty big (500Mb - 3Gb) and I'm tight on CPU and memory resources, here are few questions to the java SO community:




  1. Should I ever try to close streams I got from third-party library?

  2. What are possible dangerous implications of unclosed streams (not counting extra GC workload)

  3. Are these implications somewhat proportional to the stream size?



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails