GithubHelp home page GithubHelp logo

phive-binary's Introduction

phive-binary

javadoc Maven Central

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.

Basic usage

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:

  1. Get IFileFormatDescriptor from FileFormatRegistry.getInstance ()
  2. Choose the IPhiveContentValidator from the file format descriptor (this object can be cached by the way)
  3. Let the content validator check if the provided value matches

Extensibility

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.

Maven usage

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>

News and Noteworthy

  • 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

phive-binary's People

Contributors

phax avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.