Open visch opened 7 years ago
Hi @visch, You're right, part of the README was copied from SSHJ ;). The goal is indeed to have some usage examples, Feel free to send a PR with examples if you happen to have some time.
Yes, it would be nice to add examples of the use the library
How to use it? I cannot find documentation (other than the class references) or any example in this site or by searching Google. I am not even looking for detailed examples; I am just looking for a basic example like reading a file from a Windows shared directory, and I cannot find it.
@HubKing have you looked at the SmbjTest testcases? They should provide some starting point at least.
@hierynomus I am currently working on some usage examples in Groovy and I was wondering if you preferred them in Java over Groovy or what your preference was in general?
@NinjaChris16 I sent a small PR for the examples currently on the README and they are in Java. I guess you could also have Groovy examples but @hierynomus has to decide if he wants them...
Either Java or Groovy works. I'm still thinking about what would be the best approach. I've rewritten one of the integration tests to be more clear. Maybe if we add more integration tests usage is clearer. Those would be in Groovy.
Or like in sshj we add a directory with copy-paste examples. I would prefer those to be in Java.
Sent from my Samsung SM-G950F using FastHub
are there any examples of using the SmbFiles.copy(File source, DiskShare share, String destPath, boolean overwrite) method?
hi All, here again to annoy all of you, seeking for documentation :)... after having performed a copy from android to a windows share, I'm trying to understand how to do the reverse... copy from windows share to android \Dowload folder... is it just a matter of providing the AndroidPath + fileName as the destPath parameter of the SmbFiles.copy method, like
String androidDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)).getPath(); String inFileName = "fileName.txt" File fileIn = new File(androidDirectory, inFileName); int writtenB = SmbFiles.copy(fileIn, share, **androidDirectory + "/" + inFileName**, true);
?
and what about reading a share inputstream? for instance, jcifs provided a SmbFileInputStream to read similarly to
StringBuilder outBuilder = new StringBuilder(); BufferedReader reader = null; String lineReader = null; try { SmbFile smbFile = new SmbFile(fileName, auth); if (smbFile.exists()) { reader = new BufferedReader(new InputStreamReader(new **SmbFileInputStream(smbFile)**)); while ((lineReader = reader.readLine()) != null) { if (outBuilder.length() > 0) { outBuilder.append("\n"); } outBuilder.append(lineReader); } } } catch (Exception ex) { m_Params.Exception = ex.getMessage(); } finally { try { if ( reader != null) { reader.close(); } reader = null; } catch (Exception ex) { m_Params.Exception = ex.getMessage(); } }
does the project provide similar features? TIA Andrea
Hello,
I've just started to use this lib and I found it very hard to make things work. Is this issue still open? Are there more examples than in the README ?
Thanks
@viorelAlexandrescu There are some Tests/Specifications in the repository that helped me a lot to implement it in our application.
@TheRealHypo could you please provide a path towards those resources? thank you!
The readme mentions some examples (Maybe copied from sshj), but I don't think there's any available?
Examples would be awesome :D