I have a class where on the one hand, it feels right to return an InputStream from a public method, e.g.
public class MyClass {
    private File _file;
    ...
    public InputStream getInputStream() {
        return new FileInputStream( _file );
    }
}
However, I'm also very cautious about doing this, as it puts the onus on the caller to close this stream. What ways can I potentially avoid this problem?
 
     
     
     
     
    