Source:
public static void main(final String args[]) throws IOException, URISyntaxException, SignatureException, XmlProcessingException { try (final Ds3Client client = Ds3ClientBuilder.fromEnv().withHttps(false).build()) { final String bucketName = "recover_get_books_job_bucket"; Ds3ClientHelpers helper = Ds3ClientHelpers.wrap(client); helper.ensureBucketExists(bucketName); final Path inputPath = Paths.get("input"); final Iterable<Ds3Object> objects = helper.listObjectsForDirectory(inputPath); final Ds3ClientHelpers.Job job = helper.startWriteJob(bucketName, objects); job.transfer(new FileObjectPutter(inputPath)); final Path downloadPath = FileSystems.getDefault().getPath("output"); if (!Files.exists(downloadPath)) { Files.createDirectory(downloadPath); } final List<Ds3Object> objectsList = Lists.newArrayList(objects); final Ds3Object object1 = objectsList.get(0); final FileChannel channel1 = FileChannel.open( downloadPath.resolve(object1.getName()), StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING ); final Ds3ClientHelpers.Job readJob = helper.startReadJob(bucketName, objectsList); client.getObject(new GetObjectRequest(bucketName, object1.getName(), 0, readJob.getJobId(), channel1)); try { final Ds3ClientHelpers.Job recoverJob = helper.recoverReadJob(readJob.getJobId()); final Ds3Object object2 = objectsList.get(1); final FileChannel channel2 = FileChannel.open( downloadPath.resolve(object2.getName()), StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING ); client.getObject(new GetObjectRequest(bucketName, object2.getName(), 0, recoverJob.getJobId(), channel2)); } catch (final JobRecoveryException e) { System.out.println("Could not recover ReadJob " + readJob.getJobId().toString()); e.printStackTrace(); } } catch (final IOException e) { System.out.println("Unable to create a client from ENV. Please verify that DS3_ENDPOINT, DS3_ACCESS_KEY, and DS3_SECRET_KEY are defined."); } }

Target:
public static void main(final String args[]) throws IOException, URISyntaxException, SignatureException, XmlProcessingException { try (final Ds3Client client = Ds3ClientBuilder.fromEnv().withHttps(false).build()) { final String bucketName = "recover_get_books_job_bucket"; Ds3ClientHelpers helper = Ds3ClientHelpers.wrap(client); helper.ensureBucketExists(bucketName); final String inputDir = "input/"; final Path inputPath = Paths.get(inputDir); final Iterable<Ds3Object> objects = helper.listObjectsForDirectory(inputPath); final Ds3ClientHelpers.Job job = helper.startWriteJob(bucketName, objects); job.transfer(new FileObjectPutter(inputPath)); final Path downloadPath = FileSystems.getDefault().getPath("output/"); if (!Files.exists(downloadPath)) { Files.createDirectory(downloadPath); } final List<Ds3Object> objectsList = Lists.newArrayList(objects); final Ds3ClientHelpers.Job readJob = helper.startReadJob(bucketName, objectsList); final Ds3Object object1 = objectsList.get(0); final FileChannel channel1 = FileChannel.open( downloadPath.resolve(object1.getName()), StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING ); client.getObject(new GetObjectRequest(bucketName, object1.getName(), 0, readJob.getJobId(), channel1)); try { final Ds3ClientHelpers.Job recoverJob = helper.recoverReadJob(readJob.getJobId()); recoverJob.transfer(new FileObjectGetter(downloadPath)); } catch (final JobRecoveryException e) { System.out.println("Could not recover ReadJob " + readJob.getJobId().toString()); e.printStackTrace(); } } catch (final IOException e) { System.out.println("Unable to create a client from ENV. Please verify that DS3_ENDPOINT, DS3_ACCESS_KEY, and DS3_SECRET_KEY are defined."); } }