FormatBMP, FormatCLASS, FormatJPEG, FormatPNG, FormatZIP, and the in-development FormatDEX and FormatELF) are ordinary Java modules with no GUI or HTTP server code in them. They depend only on CommonLib and the JDK, so you can drop one or more of them into your own project to parse binary files programmatically, walk the resulting component tree, and extract structured data — all without starting a Swing application or a web server.
Available Format JARs
FormatBMP
Parser for the BMP (Device Independent Bitmap) image format. Parses the file header, DIB header, color table, and pixel array.
FormatCLASS
Parser for Java
.class files. Decodes the constant pool, fields, methods, and all standard JVM attributes.FormatJPEG
Parser for JPEG image files. Walks the JPEG segment markers and their payloads.
FormatPNG
Parser for PNG image files. Decodes the PNG signature and all chunk types.
FormatZIP
Parser for ZIP archive files. Decodes local file entries, the central directory, and the end-of-central-directory record.
FormatDEX
In development. Parser for Android Dalvik Executable (DEX) files. API may change between releases.
FormatELF
In development. Parser for ELF (Executable and Linkable Format) binaries used on Linux and other Unix-like systems. API may change between releases.
All format JARs depend only on
CommonLib and the JDK — no third-party runtime libraries are required. Adding a single format JAR to your project brings in exactly two JARs: the format module itself and CommonLib.Adding a Format JAR to Your Project
The format JARs are not yet published to Maven Central. You must build them locally first:mvn install, the JARs are available in your local Maven repository (~/.m2/repository/org/binaryinternals/). Reference them in your own project’s pom.xml:
CommonLib, so you do not need to list CommonLib separately.
Parsing a File Programmatically
Using a Format Class Directly
Instantiate the format class with ajava.nio.file.Path, then call generateTreeNode to build the component tree. The tree consists of DefaultMutableTreeNode objects whose getUserObject() returns a JTreeNodeFileComponent.
JTreeNodeFileComponent exposes:
Getting JSON Output Without the HTTP Layer
If you want JSON output but do not want to run the embedded web server, useParseService from the BinaryInternalsWeb module directly. ParseService uses ServiceLoader to find all format plugins on the module path, then parses the given bytes and serializes the tree to JSON.
First add BinaryInternalsWeb to your dependencies:
ParseService.parse():
ParseService selects the correct parser by the file extension in the fileName argument, writes a temporary copy of fileBytes to the tempDir you provide, parses it, and immediately deletes the temporary file. The returned JSON has the shape:
icon, description, and children are omitted from nodes where they are absent.
You can also inspect the list of loaded plugins before parsing:
Module Path Configuration
If your project uses the Java Platform Module System, add theprovides usage declaration to your own module-info.java so the ServiceLoader wiring is explicit:
provides / uses wiring in module-info.java is honoured: