Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

Add the Format API #100

Merged
merged 10 commits into from
May 25, 2020
Merged

Add the Format API #100

merged 10 commits into from
May 25, 2020

Conversation

mickael-menu
Copy link
Member

PR #99 needs to be reviewed and merged first.

Implementation of the Format API proposal.

Compared to the existing solution in the Kotlin toolkit, this new API offers:

  • a centralized place for everything related to formats, it was a bit spread out
  • content sniffing to detect a format when you only have a file (or bytes) without extension nor media type
  • we can now differentiate various JSON-based formats
  • extensibility for custom formats provided by reading apps
  • handling edge cases with media types comparisons, simple equality check is not enough since they can have parameters in different order and they are case-sensitive only for the parameter values

The original Format API proposal is extended a bit to take advantage of Android capabilities. The sniffing algorithm is going through the provided sniffers, but if no known Format is found, then it falls back on Android's detection mechanism using:

The format detection is fully covered by a unit test suite.

@mickael-menu mickael-menu merged commit c7b2e9b into develop May 25, 2020
@mickael-menu mickael-menu deleted the feature/format branch May 25, 2020 14:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants