A validation library for binary formats inspired by phive. The goal of the library is to make sure, that certain binary file types can be checked for validity based on either file extension or MIME Type.
This project is part of my Peppol solution stack. See https://github.com/phax/peppol for other components and libraries in that area.
Each file format is implemented as an instance of IFileFormatDescriptor.
Each file format is registered into the singleton instance FileFormatRegistry.getInstance ().
Based on a file extension (e.g. pdf) or based on a MIME type (e.g. application/pdf) you need to get the IFileFormatDescriptor you need.
And for each file format descriptor several content validators may be available.
Via getContentValidatorFavourSpeed () or getContentValidatorFavourAccuracy () the matching IPhiveContentValidator can be retrieved.
And finally the content validator does the actual matching.
So to summarize:
- Get
IFileFormatDescriptorfromFileFormatRegistry.getInstance () - Choose the
IPhiveContentValidatorfrom the file format descriptor (this object can be cached by the way) - Let the content validator check if the provided value matches
All known file formats are loaded via SPI.
By implementing the com.helger.phive.binary.IFileFormatRegistrarSPI in your application, custom file formats can be added.
Add the following to your pom.xml to use this artifact, replacing x.y.z with the real version number:
<dependency>
<groupId>com.helger.phive</groupId>
<artifactId>phive-binary</artifactId>
<version>x.y.z</version>
</dependency>v0.3.0 - 2025-11-16
- Updated to ph-commons 12.1.0
- Using JSpecify annotations
v0.2.0 - 2025-08-24
- Requires Java 17 as the minimum version
- Updated to ph-commons 12.0.0
v0.1.0 - 2024-01-31
- Initial version
- Supported formats are: CSV (no content validator), GIF, JPG, PDF, PNG, PSD, TIFF, XLS, XSLX and XML