{"id":20157575,"url":"https://github.com/g4s8/mime","last_synced_at":"2025-04-09T22:53:08.758Z","repository":{"id":25799272,"uuid":"104917593","full_name":"g4s8/mime","owner":"g4s8","description":"Media types (MIME types) RFC6838","archived":false,"fork":false,"pushed_at":"2024-06-19T23:56:31.000Z","size":168,"stargazers_count":10,"open_issues_count":8,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T22:53:03.832Z","etag":null,"topics":["java-library","mime-types","oop-library"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/g4s8.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.header","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-26T17:34:56.000Z","updated_at":"2024-02-06T15:17:19.000Z","dependencies_parsed_at":"2023-01-14T03:26:49.050Z","dependency_job_id":"54255835-1002-4f65-88e8-e0540bc4d027","html_url":"https://github.com/g4s8/mime","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g4s8%2Fmime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g4s8%2Fmime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g4s8%2Fmime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g4s8%2Fmime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/g4s8","download_url":"https://codeload.github.com/g4s8/mime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125637,"owners_count":21051766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java-library","mime-types","oop-library"],"created_at":"2024-11-13T23:46:56.177Z","updated_at":"2025-04-09T22:53:08.735Z","avatar_url":"https://github.com/g4s8.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"MIME is a java library without dependencies for parsing and creating\nHTTP media-type objects, according to [RFC6838](https://tools.ietf.org/html/rfc6838) specifications.\n\n[![Maven Central](https://img.shields.io/maven-central/v/wtf.g4s8/mime)](https://mvnrepository.com/artifact/wtf.g4s8/mime)\n[![CI checks](https://github.com/g4s8/mime/actions/workflows/ci-checks.yml/badge.svg)](https://github.com/g4s8/mime/actions/workflows/ci-checks.yml)\n[![License](https://img.shields.io/github/license/g4s8/mime.svg?style=flat-square)](https://github.com/g4s8/mime/blob/master/LICENSE.txt)\n[![Test Coverage](https://img.shields.io/codecov/c/github/g4s8/mime.svg?style=flat-square)](https://codecov.io/github/g4s8/mime?branch=master)\n\n## Usage\n\nMIME type has mandatory type and subtype, e.g. `application/json` has `application` type\nand `json` subtype. Some MIME types has additional parameters, e.g. `text/plain; encoding=utf-8` has\n`encoding` param with `utf-8` value.\n\nFor all these entities there are related method exist. To construct MIME parser uses `MimeType.of` function:\n```java\nvar mime = MimeType.of(\"text/xml; encoding=utf-8\");\nvar type = mime.type(); // \"text\"\nvar subtype = mime.subtype(); // \"xml\"\nvar encoding = mime.param(\"encoding\"); // \"utf-8\"\n```\n\nTo parse multi-value mime-type strings (like `Accept` header value), use `MimeType.parse(String)` method, it pays attention to qualifier\nof each value and sorts mime types using this qualifier.\n*Example:*\n```java\nMimeType.parse(\"text/html;q=0.6, application/xml;q=0.9, image/bmp;q=0.3,image/bmp;q=0.5, text/html, multipart/mixed, text/json;q=0.4\")\n```\nreturns a lits of:\n 1. `multipart/mixed`\n 2. `text/html`\n 3. `application/xml`\n 4. `image/bmp`\n 5. `text/json`\n\n## Testing\n[Hamcrest](http://hamcrest.org/JavaHamcrest/) matchers are included in `test` package. Them can be used to verify mime-types:\n```java\n// verify type\nMatcherAssert.assertThat(\n    MimeType.of(\"application/pdf\"),\n    new HmMimeHasType(\"application\")\n);\n\n// verify subtype\nMatcherAssert.assertThat(\n    MimeType.of(\"image/bmp\"),\n    new HmMimeHasSubType(\"bmp\")\n);\n\n// verify parameter\nMatcherAssert.assertThat(\n    MimeType.of(\"image/bmp; charset=utf-8\"),\n    new HmMimeHasParameter(\"charset\", \"utf-8\")\n);\n```\n\n## Contributing\nIf you are interested in contributing please refer to [CONTRIBUTING.md](CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg4s8%2Fmime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fg4s8%2Fmime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg4s8%2Fmime/lists"}