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

[FEATURE REQ] Improve FileContent.toStream(). #29054

Closed
kasobol-msft opened this issue May 24, 2022 · 1 comment
Closed

[FEATURE REQ] Improve FileContent.toStream(). #29054

kasobol-msft opened this issue May 24, 2022 · 1 comment
Labels
Azure.Core azure-core
Milestone

Comments

@kasobol-msft
Copy link
Contributor

Follow up from #29047 .

The FileContent.toStream() looks like this:

@Override
public InputStream toStream() {
try {
return new BufferedInputStream(new FileInputStream(file.toFile()), chunkSize);
} catch (FileNotFoundException e) {
throw LOGGER.logExceptionAsError(new UncheckedIOException("File not found " + file, e));
}
}

This has the following problems:

  • Setting chunkSize large make BufferedInputStream allocate large arrays.
  • The return stream's mark/reset would use BufferedInputStream imlementation that would buffer in memory up to readLimit.

These are inefficient given that file is a durable and seekable source.

We should consider building input stream based on filechannel instead. The built in Channels.newInputStream aren't great - they don't allow mark/reset, so we should probably go for custom implementation.

Copy link

Hi @kasobol-msft, we deeply appreciate your input into this project. Regrettably, this issue has remained unresolved for over 2 years and inactive for 30 days, leading us to the decision to close it. We've implemented this policy to maintain the relevance of our issue queue and facilitate easier navigation for new contributors. If you still believe this topic requires attention, please feel free to create a new issue, referencing this one. Thank you for your understanding and ongoing support.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2024
@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Core azure-core
Projects
Status: Done
Development

No branches or pull requests

2 participants