in java/com/google/cloud/deploymentmanager/autogen/cli/OutputWriterFactory.java [129:156]
void writeOutput(Message message) throws IOException {
Map<String, SolutionPackage> solutions;
if (message instanceof BatchOutput) {
final BatchOutput batchMessage = (BatchOutput) message;
ImmutableMap.Builder<String, SolutionPackage> builder = ImmutableMap.builder();
for (BatchOutput.SolutionOutput solution : batchMessage.getSolutionsList()) {
builder.put(solution.getPartnerId() + "/" + solution.getSolutionId(),
solution.getPackage());
}
solutions = builder.buildOrThrow();
} else {
solutions = ImmutableMap.of("", (SolutionPackage) message);
}
for (Map.Entry<String, SolutionPackage> entry : solutions.entrySet()) {
for (SolutionPackage.File file : entry.getValue().getFilesList()) {
String filePath =
Paths.get(this.settings.getOutput(), entry.getKey(), file.getPath()).toString();
File outputFile = new File(filePath);
Files.createParentDirs(outputFile);
if (filePath.endsWith(".png") || filePath.endsWith(".jpg")) {
Files.write(BaseEncoding.base64().decode(file.getContent()), outputFile);
} else {
Files.asCharSink(outputFile, UTF_8).write(file.getContent());
}
}
}
}