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

Added a "how to read file" example #461

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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

Merging #461 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update adb73c8...4b9d6df. Read the comment docs.

@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