docs: public void getObject(String bucketName, String objectName, ServerSideEncryption sse, String fileName)
            throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
            InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
            InternalException, InvalidArgumentException {
  
      if ((sse.getType() == ServerSideEncryption.Type.SSE_S3)
              || (sse.getType() == ServerSideEncryption.Type.SSE_KMS)) {
        throw new InvalidArgumentException("Invalid encryption option specified for encryption type " + sse.getType());
      } else if ((sse.getType() == ServerSideEncryption.Type.SSE_C) && (!this.baseUrl.isHttps())) {
        throw new InvalidArgumentException("SSE-C provided keys must be made over a secure connection.");
      }
  
      Path filePath = Paths.get(fileName);
      boolean fileExists = Files.exists(filePath);
  
      if (fileExists && !Files.isRegularFile(filePath)) {
        throw new InvalidArgumentException(fileName + ": not a regular file");
      }
  
      ObjectStat objectStat = statObject(bucketName, objectName, sse);
      long length = objectStat.length();
      String etag = objectStat.etag();
  
      String tempFileName = fileName + "." + etag + ".part.minio";
      Path tempFilePath = Paths.get(tempFileName);
      boolean tempFileExists = Files.exists(tempFilePath);
  
      if (tempFileExists && !Files.isRegularFile(tempFilePath)) {
        throw new IOException(tempFileName + ": not a regular file");
      }
  
      long tempFileSize = 0;
      if (tempFileExists) {
        tempFileSize = Files.size(tempFilePath);
        if (tempFileSize > length) {
          Files.delete(tempFilePath);
          tempFileExists = false;
          tempFileSize = 0;
        }
      }
  
      if (fileExists) {
        long fileSize = Files.size(filePath);
        if (fileSize == length) {
          // already downloaded. nothing to do
          return;
        } else if (fileSize > length) {
          throw new InvalidArgumentException("Source object, '" + objectName + "', size:" + length
                  + " is smaller than the destination file, '" + fileName + "', size:" + fileSize);
        } else if (!tempFileExists) {
          // before resuming the download, copy filename to tempfilename
          Files.copy(filePath, tempFilePath);
          tempFileSize = fileSize;
          tempFileExists = true;
        }
      }
  
      InputStream is = null;
      OutputStream os = null;
      try {
        is = getObject(bucketName, objectName, sse);
        os = Files.newOutputStream(tempFilePath, StandardOpenOption.CREATE, StandardOpenOption.APPEND);
        long bytesWritten = ByteStreams.copy(is, os);
        is.close();
        os.close();
  
        if (bytesWritten != length - tempFileSize) {
          throw new IOException(tempFileName + ": unexpected data written.  expected = " + (length - tempFileSize)
                  + ", written = " + bytesWritten);
        }
        Files.move(tempFilePath, filePath, StandardCopyOption.REPLACE_EXISTING);
      } finally {
        if (is != null) {
          is.close();
        }
        if (os != null) {
          os.close();
        }
      }
  
  
    }