if(withChecksum) {
ZipResult zipResult = ZipUtils.createZipAndCheck(folder, zip_tmp, zipName, compress);
if(createByReference) {
DigitalObject digOb = null;
digOb = new DigitalObject.Builder(Content.byReference(getUrlFromFile(zipResult.getZipFile()))
.withChecksum(zipResult.getChecksum()))
.title(zipName)
.format(format.createExtensionUri("zip"))
.fragments(ZipUtils.getAllFragments(zipResult.getZipFile()))
.build();
return digOb;
}
else {
DigitalObject digOb = new DigitalObject.Builder(Content.byReference(zipResult.getZipFile())
.withChecksum(zipResult.getChecksum()))
.title(zipName)
.format(format.createExtensionUri("zip"))
.fragments(ZipUtils.getAllFragments(zipResult.getZipFile()))
.build();
return digOb;
}
}
else {
File result = ZipUtils.createZip(folder, zip_tmp, zipName, compress);
if(createByReference) {
DigitalObject digOb = null;
digOb = new DigitalObject.Builder(Content.byReference(getUrlFromFile(result)))
.title(zipName)
.format(format.createExtensionUri("zip"))
.fragments(ZipUtils.getAllFragments(result))
.build();
return digOb;
}
else {
DigitalObject digOb = new DigitalObject.Builder(Content.byReference(result))
.title(zipName)
.format(format.createExtensionUri("zip"))
.fragments(ZipUtils.getAllFragments(result))
.build();
return digOb;