Skip to content

Conversation

@MattBrou
Copy link

@MattBrou MattBrou commented May 2, 2019

Took me a while to figure out how to properly read a file with SMBJ library. So I thought I'd share my solution.

Took me a while to figure out how to properly read a file with SMBJ library. So I thought I'd share my solution.
@MattBrou MattBrou changed the title Added an example Added a "how to read file" example May 2, 2019
@codecov
Copy link

codecov bot commented May 2, 2019

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 44.19%. Comparing base (adb73c8) to head (4b9d6df).
Report is 113 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jerrychong25
Copy link

Yes, I agree with to add a example on how to read & write file.

As documentation did not mentioned about it.

@jerrychong25
Copy link

jerrychong25 commented Jul 10, 2019

@MattBrou,

Do you have an example on how to write new content into file after read a file?

Flow:
Read File -> Add New Content -> Write File -> Save File

@MattBrou MattBrou requested a review from hierynomus as a code owner January 31, 2020 13:05
.collect(Collectors.joining(System.lineSeparator()))

//'content' holds the file's content
return content;
Copy link
Owner

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants