@Nonnull
	@Override
	public Info readInfo(@Nonnull String name, @Nonnull ByteSource source) throws IOException {
		byte[] data = source.readAll();

		// Check for Java classes
		if (matchesClass(data)) {
			try {
				int readerFlags = config.doSkipCodeParing() ? ClassReader.SKIP_CODE : 0;

				// If we're skipping validation, any ASM parse failures will result in the class
				// being treated as a file instead (see catch block)
				if (config.doSkipAsmValidation())
					return new JvmClassInfoBuilder(data, readerFlags).build();

				// If we are doing validation, disable skipping ASM checks.
				try {
					return new JvmClassInfoBuilder()
							.skipValidationChecks(false)
							.adaptFrom(data, readerFlags)
							.build();
				} catch (Throwable t) {
					// Patch if not compatible with ASM
					byte[] patched = classPatcher.patch(name, data);
					logger.debug("CafeDude patched class: {}", name);
					try {
						return new JvmClassInfoBuilder(patched, readerFlags)
								.skipValidationChecks(false)
								.build();
					} catch (Throwable t1) {
						logger.error("CafeDude patching output is still non-compliant with ASM for file: {}", name);
						return new FileInfoBuilder<>()
								.withRawContent(data)
								.withName(name)
								.build();
					}
				}
			} catch (Throwable t) {
				// Invalid class, either some new edge case we need to add to CafeDude, or the file
				// isn't a class, but the structure models it close enough to look like one at a glance.
				// It may be unpacked later.
				return new FileInfoBuilder<>()
						.withRawContent(data)
						.withName(name)
						.withProperty(IllegalClassSuspectProperty.INSTANCE)
						.build();
			}
		}

		// Comparing against known file types.
		boolean hasZipMarker = ByteHeaderUtil.matchAtAnyOffset(data, ByteHeaderUtil.ZIP);
		FileInfo info = readAsSpecializedFile(name, data);
		if (info != null) {
			if (hasZipMarker)
				ZipMarkerProperty.set(info);
			return info;
		}

		// Check for ZIP containers (For ZIP/JAR/JMod/WAR)
		//  - While this is more common, some of the known file types may match 'ZIP' with
		//    our 'any-offset' condition we have here.
		//  - We need 'any-offset' to catch all ZIP cases, but it can match some of the file types
		//    above in some conditions, which means we have to check for it last.
		if (hasZipMarker) {
			ZipFileInfoBuilder builder = new ZipFileInfoBuilder()
					.withProperty(new ZipMarkerProperty())
					.withRawContent(data)
					.withName(name);

			// Record name, handle extension to determine info-type
			String extension = IOUtil.getExtension(name);
			if (extension == null) return builder.build();
			return switch (extension.toUpperCase()) {
				case "JAR" -> builder.asJar().build();
				case "APK" -> builder.asApk().build();
				case "WAR" -> builder.asWar().build();
				case "JMOD" -> builder.asJMod().build();
				default -> builder.build();
			};
		}

		// No special case known for file, treat as generic file
		// Will be automatically mapped to a text file if the contents are all mappable characters.
		return new FileInfoBuilder<>()
				.withRawContent(data)
				.withName(name)
				.build();
	}
Basic implementation of the info importer.

@author Matt Coley
recaf-core/src/main/java/software/coley/recaf/services/workspace/io/BasicInfoImporter.java