title: SmbFileOutputStream write creating corrupted jpg files
body: <p>I'm using JCIFS SmbFileOutputStream write to upload jpg (and mp4) files to a share on a local Windows network. While this works well most of the time, I sometimes find that the resulting files are corrupt - e.g. if it's a jpg perhaps only the top part of the photo will be legible/visible. </p>
  
  <p>I have the upload in a try/catch block, but it is not throwing an exception. Is there any way that I can verify that a file has been uploaded correctly?</p>
  
  <pre><code>try {
      if (debugging_on) {
          logger.info("UploadService.011 UploadFiles: uploading file:" + destFileName);
      }
      SmbFileOutputStream sfos = new SmbFileOutputStream(sFile);
      FileInputStream fileInputStream = new FileInputStream(new File(
              sSourceFilePath));
      byte[] buf = new byte[16 * 1024 * 1024];
      int len;
      while ((len = fileInputStream.read(buf)) &gt; 0) {
          sfos.write(buf, 0, len);
      }
      fileInputStream.close();
      sfos.close();
      // Update the database to include the date/time of this upload
      millisStart = Calendar.getInstance().getTimeInMillis();
      sql = "UPDATE upload_history SET file_uploaded_date = "
              + millisStart + " WHERE filename = '" + filename + "'";
      db.execSQL(sql);
  
  } catch (Exception e) {
      mNotifyBuilder.setContentText("Upload error - check folder permissions");
      mNotificationManager.notify(1, mNotifyBuilder.build());
      return "WriteFailure";
  </code></pre>