OutputStreamWriter writer = new OutputStreamWriter(zos);
for (ObjectSpecification objectSpec : domainObjectSpecs) {
zos.putNextEntry(new ZipEntry(zipEntryNameFor(objectSpec)));
writer.write(propertiesReader.asJson(objectSpec));
writer.flush();
zos.closeEntry();
}
writer.close();
return new Blob("layouts.zip", mimeTypeApplicationZip, baos.toByteArray());
} catch (final IOException ex) {
throw new FatalException("Unable to create zip of layouts", ex);