Skip to content
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

refactor FileResource.inputStream to be easier to use #2271

Closed
wants to merge 1 commit into from

Conversation

mkristian
Copy link
Member

for any client code which needs to convert a uri-like path to an inputstream
the way to go is JRubyFile.create(runtime, path).inputStream()

the motivation for this PR comes from jruby-openssl-0.9.6.dev:

from the user there comes a String with path to a PEM resource. as it turns out this path can be any uri-like path (like from rubygems: https://github.com/jruby/jruby/blob/master/lib/ruby/stdlib/rubygems/request.rb#L42).

the following boilerplate code to convert a uri-like path into an input-stream:
jruby/jruby-openssl@aa51d9b#diff-67972a6a9364f41a90295ceabf0e9180R298
is a fix for jruby-1.7.16.1

this PR cleans up the API for such "conversion" and to release jruby-openssl with this clean API it needs a released jruby version with this PR merged.

@mkristian mkristian added this to the JRuby 1.7.17 milestone Dec 3, 2014
for any client code which needs to convert a uri-like path to an inputstream
the way to go is ```JRubyFile.create(runtime, path).inputStream()```
/**
* opens input-stream to the underlying resource. this is place where
* the input-stream gets opened. users of this method should follow the pattern:
* close the stream where you open it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep rationale for closing (implementations allocating native memory) in the new comment.

@mkristian
Copy link
Member Author

merge manually

@mkristian mkristian closed this Dec 5, 2014
@mkristian mkristian deleted the FileResource.inputStream branch December 6, 2014 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants