Allows you to create a temporary zip file of Box files and folders and download them.
Calling BoxZip.create(String name, List<BoxZipItem> items)
will let you create a new zip file with the specified name and
with the specified items and will return a BoxZipInfo
object with the download link. This file does not show up in your Box account, but will be temporarily
available for download.
ArrayList<BoxZipItem> items = new ArrayList<BoxZipItem>();
BoxZipItem file = new BoxZipItem("file", "12345");
BoxZipItem folder = new BoxZipItem("folder", "156472");
items.add(file);
items.add(folder);
BoxZip zip = new BoxZip(api);
BoxZipInfo zipInfo = zip.create("Awesome Zip File", items);
Calling BoxZip.download(String name, List<BoxZipItem> items, OutputStream output)
will let you create a new zip file
with the specified name and with the specified items and download it to the stream that is passed in. The return object is a BoxZipDownloadStatus
object that contains information about the download, including whether it was successful. The created zip file does not show up in your Box account.
ArrayList<BoxZipItem> items = new ArrayList<BoxZipItem>();
BoxZipItem file = new BoxZipItem("file", "12345");
BoxZipItem folder = new BoxZipItem("folder", "156472");
items.add(file);
items.add(folder);
BoxZip zip = new BoxZip(api);
FileOutputStream stream = new FileOutputStream();
BoxZipDownloadStatus zipDownloadStatus = zip.download("Another Awesome Zip File", items, stream);
stream.close();
if (zipDownloadStatus.getState() == BoxZipDownloadStatus.State.SUCCEEDED) {
System.out.println("Zip downloaded successfully");
}