I am trying to write a file in my local drive which is available in a network drive on a server. I can write this image and I can see even the size of the file available. But, when I'm opening the file it says preview not available. Content of the file is not coming.
Code which I read the network file
SmbFileInputStream sfis = null;
sfis = new SmbFileInputStream(serverFile);
fileBytes = new byte[(int) serverFile.length()];
sfis.read(fileBytes);
Code which I write the file in my local drive
FileOutputStream fos;
fos = new FileOutputStream(tempFile);
fos.write(fileBytes);
I also tried with file.copyTo method by giving my local file like a smbfile.
serverFile.copyTo(ss);
I figured it out and it works fine.
Change first two lines to
InputStream sfis = new SmbFileInputStream(serverFile);
real change is reference of the variable is now
InputStream