Was wondering if anyone else has had this problem and if they have been able to solve? I have a Music Playing app which can play music stored on my PC on my android device.
I’m sure this is not the most efficient way to do it, but basically it downloads the music file from the PC to a temporary file on the phone, then plays the file.
This was working fine until I upgraded my PC to Windows 10, but has not worked since then. I have not made any changes to the code, which uses the jcifs-1.3.17.jar library.
This is the code:
SmbFile smbFileToDownload = null;
String user = "My Windows 10 User Name";
String pass ="My Windows 10 Password";
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("",user, pass);
smbFileToDownload = new SmbFile(strPCPath,auth);
InputStream inputStream = null;
inputStream = smbFileToDownload.getInputStream();
String localFilePath = “The Path to where the local file will be stored”;
OutputStream out = null;
out = new FileOutputStream(localFilePath);
byte buf[] = new byte[1024];
int len;
// GET TO HERE OK, THEN EXCEPTION THROWN
while ((len = inputStream.read(buf)) > 0) {
out.write(buf, 0, len);
}
out.flush();
out.close();
inputStream.close();
When debugging, I get to the while line, it takes an age to get past this on the 1st pass, then on the 2nd pass it is throwing an exception. When I look in the temp dir, there is a file there, but only 1kb in size. Thanks for any help anyone can provide.