Home / Class/ StoredEntryPreparator Class — spring-boot Architecture

StoredEntryPreparator Class — spring-boot Architecture

Architecture documentation for the StoredEntryPreparator class 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 558–594

	private static class StoredEntryPreparator {

		private static final int BUFFER_SIZE = 32 * 1024;

		private final boolean unpack;

		private final CRC32 crc = new CRC32();

		private long size;

		StoredEntryPreparator(ThrowingSupplier<InputStream> input, boolean unpack) throws IOException {
			this.unpack = unpack;
			try (InputStream stream = input.get()) {
				load(stream);
			}
		}

		private void load(InputStream inputStream) throws IOException {
			byte[] buffer = new byte[BUFFER_SIZE];
			int bytesRead;
			while ((bytesRead = inputStream.read(buffer)) != -1) {
				this.crc.update(buffer, 0, bytesRead);
				this.size += bytesRead;
			}
		}

		void prepareStoredEntry(ZipArchiveEntry entry) {
			entry.setSize(this.size);
			entry.setCompressedSize(this.size);
			entry.setCrc(this.crc.getValue());
			entry.setMethod(ZipEntry.STORED);
			if (this.unpack) {
				entry.setComment("UNPACK");
			}
		}

	}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free