Source:
public ObjectStorageSpaceVerificationResult objectsFromBucketWillFitInDirectory(final Ds3ClientHelpers helpers, final String bucketName, final Collection<String> objectNames, final Path destinationDirectory) { Preconditions.checkNotNull(helpers, "helpers may not be null."); Guard.throwOnNullOrEmptyString(bucketName, "bucketName must have a non-empty value."); Preconditions.checkNotNull(objectNames, "objectNames may not be null."); Preconditions.checkNotNull(destinationDirectory, "destinationDirectory may not be null."); long requiredSpace = 0; long availableSpace = 0; final IOException ioException = null; if ( ! pathObjectExists(destinationDirectory)) { return new ObjectStorageSpaceVerificationResult(ObjectStorageSpaceVerificationResult.VerificationStatus.PathDoesNotExist, requiredSpace, availableSpace, ioException); } if ( ! pathIsDirectory(destinationDirectory)) { return new ObjectStorageSpaceVerificationResult(ObjectStorageSpaceVerificationResult.VerificationStatus.PathIsNotADirectory, requiredSpace, availableSpace, ioException); } if ( ! pathIsWritable(destinationDirectory)) { return new ObjectStorageSpaceVerificationResult(ObjectStorageSpaceVerificationResult.VerificationStatus.PathLacksAccess, requiredSpace, availableSpace, ioException); } try { helpers.ensureBucketExists(bucketName); } catch (final IOException e) { return new ObjectStorageSpaceVerificationResult(ObjectStorageSpaceVerificationResult.VerificationStatus.BucketDoesNotExist, requiredSpace, availableSpace, ioException); } try { requiredSpace = getRequiredSpaceForObjects(getObjectSizes(helpers, bucketName, objectNames)); availableSpace = getAvailableFileSpace(destinationDirectory); } catch (final IOException e) { return new ObjectStorageSpaceVerificationResult(ObjectStorageSpaceVerificationResult.VerificationStatus.CaughtIOException, requiredSpace, availableSpace, e); } final ObjectStorageSpaceVerificationResult.VerificationStatus verificationStatus = availableSpace > requiredSpace ? ObjectStorageSpaceVerificationResult.VerificationStatus.OK : ObjectStorageSpaceVerificationResult.VerificationStatus.PathLacksSufficientStorageSpace; return new ObjectStorageSpaceVerificationResult(verificationStatus, requiredSpace, availableSpace, ioException); }

Target:
public ObjectStorageSpaceVerificationResult objectsFromBucketWillFitInDirectory(final Ds3ClientHelpers helpers, final String bucketName, final Collection<String> objectNames, final Path destinationDirectory) { Preconditions.checkNotNull(helpers, "helpers may not be null."); Guard.throwOnNullOrEmptyString(bucketName, "bucketName must have a non-empty value."); Preconditions.checkNotNull(objectNames, "objectNames may not be null."); Preconditions.checkNotNull(destinationDirectory, "destinationDirectory may not be null."); long requiredSpace = 0; long availableSpace = 0; if ( ! pathObjectExists(destinationDirectory)) { final IOException ioException = null; return new ObjectStorageSpaceVerificationResult(ObjectStorageSpaceVerificationResult.VerificationStatus.PathDoesNotExist, requiredSpace, availableSpace, ioException); } if ( ! pathIsDirectory(destinationDirectory)) { final IOException ioException = null; return new ObjectStorageSpaceVerificationResult(ObjectStorageSpaceVerificationResult.VerificationStatus.PathIsNotADirectory, requiredSpace, availableSpace, ioException); } if ( ! pathIsWritable(destinationDirectory)) { final IOException ioException = null; return new ObjectStorageSpaceVerificationResult(ObjectStorageSpaceVerificationResult.VerificationStatus.PathLacksAccess, requiredSpace, availableSpace, ioException); } try { helpers.ensureBucketExists(bucketName); } catch (final IOException e) { final IOException ioException = null; return new ObjectStorageSpaceVerificationResult(ObjectStorageSpaceVerificationResult.VerificationStatus.BucketDoesNotExist, requiredSpace, availableSpace, ioException); } try { requiredSpace = getRequiredSpaceForObjects(helpers, bucketName, objectNames); availableSpace = getAvailableFileSpace(destinationDirectory); } catch (final IOException e) { return new ObjectStorageSpaceVerificationResult(ObjectStorageSpaceVerificationResult.VerificationStatus.CaughtIOException, requiredSpace, availableSpace, e); } final ObjectStorageSpaceVerificationResult.VerificationStatus verificationStatus = availableSpace > requiredSpace ? ObjectStorageSpaceVerificationResult.VerificationStatus.OK : ObjectStorageSpaceVerificationResult.VerificationStatus.PathLacksSufficientStorageSpace; final IOException ioException = null; return new ObjectStorageSpaceVerificationResult(verificationStatus, requiredSpace, availableSpace, ioException); }