Added a "how to read file" example#461
Open
MattBrou wants to merge 3 commits intohierynomus:masterfrom
Open
Conversation
Took me a while to figure out how to properly read a file with SMBJ library. So I thought I'd share my solution.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #461 +/- ##
=========================================
Coverage 44.19% 44.19%
Complexity 905 905
=========================================
Files 231 231
Lines 6903 6903
Branches 516 516
=========================================
Hits 3051 3051
Misses 3599 3599
Partials 253 253 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Yes, I agree with to add a example on how to read & write file. As documentation did not mentioned about it. |
|
Do you have an example on how to write new content into file after read a file? Flow: |
hierynomus
requested changes
Jan 31, 2020
| .collect(Collectors.joining(System.lineSeparator())) | ||
|
|
||
| //'content' holds the file's content | ||
| return content; |
Owner
There was a problem hiding this comment.
You should also nest the share.openFile in a try-block, as the File object needs a close to release.
And don't forget to properly close the smbFileRead.getInputStream()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Took me a while to figure out how to properly read a file with SMBJ library. So I thought I'd share my solution.