@Nonnull
		public byte[] bytes() throws IOException {
			return createZip(zos -> {
				Set<String> dirsVisited = new HashSet<>();
				CRC32 crc = new CRC32();
				for (Entry entry : entries) {
					String key = entry.name;
					byte[] content = entry.content;

					// Write directories for upcoming entries if necessary
					// - Ugly, but does the job.
					if (createDirectories && key.contains("/")) {
						// Record directories
						String parent = key;
						List<String> toAdd = new ArrayList<>();
						do {
							// Abort if the max-dir depth is reached.
							if (toAdd.size() > MAX_DIR_DEPTH) {
								toAdd.clear();
								break;
							}
							parent = parent.substring(0, parent.lastIndexOf('/'));
							if (dirsVisited.add(parent)) {
								toAdd.add(0, parent + '/');
							} else break;
						} while (parent.contains("/"));
						// Put directories in order of depth
						for (String dir : toAdd) {
							// Update CRC
							crc.reset();
							crc.update(EMPTY);

							// Add the entry
							// We use STORED for directories so that the DEFLATE header doesn't clutter the
							// LocalFileHeader data store. Using STORE keeps it empty.
							ZipEntry dirEntry = new ZipEntry(dir);
							dirEntry.setSize(0);
							dirEntry.setCompressedSize(0);
							dirEntry.setMethod(ZipEntry.STORED);
							dirEntry.setCrc(crc.getValue());
							zos.putNextEntry(dirEntry);
							zos.closeEntry();
						}
					}

					// Update CRC
					crc.reset();
					crc.update(content);

					// Write ZIP entry
					//  - Always use STORED for empty files to save space.
					boolean doStore = entry.content.length == 0 || !entry.compression;
					int level = doStore ? ZipEntry.STORED : ZipEntry.DEFLATED;
					ZipEntry zipEntry = new ZipEntry(key);
					zipEntry.setMethod(level);
					zipEntry.setCrc(crc.getValue());
					if (doStore) {
						zipEntry.setSize(content.length);
						zipEntry.setCompressedSize(content.length);
					}
					if (entry.comment != null) zipEntry.setComment(entry.comment);
					if (entry.extra != null) zipEntry.setExtra(entry.extra);
					if (entry.creationTime >= 0L) zipEntry.setCreationTime(FileTime.fromMillis(entry.creationTime));
					if (entry.modifyTime >= 0L) zipEntry.setLastModifiedTime(FileTime.fromMillis(entry.modifyTime));
					if (entry.accessTime >= 0L) zipEntry.setLastAccessTime(FileTime.fromMillis(entry.accessTime));

					zos.putNextEntry(zipEntry);
					zos.write(content);
					zos.closeEntry();

					// Reset to allow name hacks
					resetNames(zos);
				}
			});
		}
@return Generated ZIP.

@throws IOException
		When the content cannot be written.
recaf-core/src/main/java/software/coley/recaf/util/ZipCreationUtils.java