Skip to content

Commit

Permalink
Cleanup for an error-free Kotlin conversion
Browse files Browse the repository at this point in the history
Differential Revision: D67673598

fbshipit-source-id: 8742cf4f08535f1409b39d5b3c220862c62da619
  • Loading branch information
Tim Trueman authored and facebook-github-bot committed Jan 2, 2025
1 parent c7745c5 commit d65a227
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
package com.facebook.common.media;

import android.webkit.MimeTypeMap;
import androidx.annotation.Nullable;
import com.facebook.common.internal.ImmutableMap;
import com.facebook.infer.annotation.Nullsafe;
import java.util.Map;

/** Wrapper around the system's {@link MimeTypeMap} that also handles types it doesn't support. */
@Nullsafe(Nullsafe.Mode.LOCAL)
public class MimeTypeMapWrapper {

private static final MimeTypeMap sMimeTypeMap = MimeTypeMap.getSingleton();
Expand All @@ -26,15 +29,15 @@ public class MimeTypeMapWrapper {
"heif", "image/heif",
"heic", "image/heic");

public static String getExtensionFromMimeType(String mimeType) {
public static @Nullable String getExtensionFromMimeType(String mimeType) {
String result = sMimeTypeToExtensionMap.get(mimeType);
if (result != null) {
return result;
}
return sMimeTypeMap.getExtensionFromMimeType(mimeType);
}

public static String getMimeTypeFromExtension(String extension) {
public static @Nullable String getMimeTypeFromExtension(String extension) {
String result = sExtensionToMimeTypeMap.get(extension);
if (result != null) {
return result;
Expand Down

0 comments on commit d65a227

Please sign in to comment.