ZipEntryContentWriter Type — spring-boot Architecture
Architecture documentation for the ZipEntryContentWriter type/interface in BootZipCopyAction.java from the spring-boot codebase.
Entity Profile
Source Code
build-plugin/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java lines 512–552
@FunctionalInterface
private interface ZipEntryContentWriter {
/**
* Write the entry data.
* @param out the output stream used to write the data
* @throws IOException on IO error
*/
void writeTo(ZipArchiveOutputStream out) throws IOException;
/**
* Create a new {@link ZipEntryContentWriter} that will copy content from the
* given {@link InputStream}.
* @param in the source input stream
* @return a new {@link ZipEntryContentWriter} instance
*/
static ZipEntryContentWriter fromInputStream(InputStream in) {
return (out) -> {
StreamUtils.copy(in, out);
in.close();
};
}
/**
* Create a new {@link ZipEntryContentWriter} that will copy content from the
* given lines.
* @param encoding the required character encoding
* @param lines the lines to write
* @return a new {@link ZipEntryContentWriter} instance
*/
static ZipEntryContentWriter fromLines(String encoding, Collection<String> lines) {
return (out) -> {
OutputStreamWriter writer = new OutputStreamWriter(out, encoding);
for (String line : lines) {
writer.append(line).append("\n");
}
writer.flush();
};
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free