-
Notifications
You must be signed in to change notification settings - Fork 182
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
Added a "how to read file" example #461
base: master
Are you sure you want to change the base?
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 Report
@@ 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 Continue to review full report at Codecov.
|
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: |
.collect(Collectors.joining(System.lineSeparator())) | ||
|
||
//'content' holds the file's content | ||
return content; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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()
Took me a while to figure out how to properly read a file with SMBJ library. So I thought I'd share my solution.