Skip to content

io7m-com/mime2045

Repository files navigation

mime2045

Maven Central Maven Central (snapshot) Codecov Java Version

com.io7m.mime2045

JVM Platform Status
OpenJDK (Temurin) Current Linux Build (OpenJDK (Temurin) Current, Linux)
OpenJDK (Temurin) LTS Linux Build (OpenJDK (Temurin) LTS, Linux)
OpenJDK (Temurin) Current Windows Build (OpenJDK (Temurin) Current, Windows)
OpenJDK (Temurin) LTS Windows Build (OpenJDK (Temurin) LTS, Windows)

mime2045

The mime2045 package provides functions for parsing RFC 2045 MIME types.

Features

  • RFC 2045 MIME type parsing.
  • Suggest file extensions for MIME types.
  • High coverage test suite.
  • OSGi-ready.
  • JPMS-ready.
  • ISC license.

Usage

Declare MIME types directly:

final var textPlain =
  MimeType.of("text", "plain");

Parse MIME type strings:

final var parsed =
  new MimeParsers().parse("text/plain");

assert textPlain.equals(parsed);

Suggest file extensions for MIME types:

final var parsed =
  new MimeParsers().parse("text/plain");

assert Optional.of("txt").equals(MimeFileExtensions.suggestFileExtension(parsed));