Module jcifs

Class MimeMap

java.lang.Object
org.codelibs.jcifs.smb1.util.MimeMap

public class MimeMap extends Object
MIME type mapping utility for file extensions. Provides mappings between file extensions and their corresponding MIME types by reading from a resource file containing extension-to-MIME-type mappings.
  • Constructor Details

    • MimeMap

      public MimeMap() throws IOException
      Creates a new MimeMap instance by loading MIME type mappings from the resource file.
      Throws:
      IOException - if there is an error reading the mime.map resource file
  • Method Details

    • getMimeType

      public String getMimeType(String extension) throws IOException
      Returns the MIME type for the given file extension. If no mapping is found, returns "application/octet-stream" as the default.
      Parameters:
      extension - the file extension to look up (without the dot)
      Returns:
      the MIME type for the extension, or "application/octet-stream" if not found
      Throws:
      IOException - if there is an error processing the MIME mappings
    • getMimeType

      public String getMimeType(String extension, String def) throws IOException
      Returns the MIME type for the given file extension with a custom default.
      Parameters:
      extension - the file extension to look up (without the dot)
      def - the default MIME type to return if no mapping is found
      Returns:
      the MIME type for the extension, or the specified default if not found
      Throws:
      IOException - if there is an error processing the MIME mappings