A simple Java application that reads and parses a custom binary log file (logi.bin), extracts messages, and generates a formatted HTML report for easy viewing.
- Binary File Parsing: Reads a
.binfile with a custom format (4-byte message size, 4-byte sequence number, and UTF-8 payload). - HTML Report Generation: Creates a clean, well-styled, and responsive HTML report by programmatically building the HTML string.
- Cross-Platform Compatibility: Uses Java's
Desktopclass to automatically open the generated report in the default web browser.
- Java Development Kit (JDK) 11 or higher
- Maven
-
Clone the Repository
git clone [https://github.com/amiths89/LogiReader.git](https://github.com/amiths89/LogiReader.git) cd LogiReader cd BinFileReader
-
Add the
logi.binFilePlace your
logi.binbinary file inside thesrc/main/resources/directory. -
Build and Run the Project
You can run the
Mainclass directly from your IDE or use the following Maven commands:mvn clean install mvn exec:java -Dexec.mainClass="org.java.bin.Main"The application will process the binary file and automatically open the
report.htmlfile in your default web browser.
src/main/java/org/java/bin/Main.java: The main application entry point that reads the binary file and calls the HTML generator.Message.java: A simple immutable class representing a message object.HtmlGenerator.java: A class that manually generates the HTML report as a string.
src/main/resources/logi.bin: The binary log file to be processed.
pom.xml: The Maven project configuration file.README.md: This file.
Main.javastarts the process by callingreadMessageto parse thelogi.binfile.- The
readMessagemethod reads the binary data, extracts the size, sequence number, and payload, and populates a list ofMessageobjects. - The
HtmlGeneratormethod then manually constructs the HTML as a single string usingStringBuilder. - Finally,
Main.javasaves the generated HTML content toreport.htmland opens it.