DEPRECATED Use `com.bea.p13n.content.MimeTypeHelper```

# com.beasys.commerce.util
MimeTypeHelper Class

public class MimeTypeHelper
extends `Object`

Utility class to help with Mime Types.

This provides support for determining the MIME type based upon a file path/extension, and determining the extensions for a MIME type.

Upon load, this class will attempt to load in the "mime.types" in the same package as it (as a resource via getResource()). If that fails, an error will be thrown. The "mime.types" file should be of the standard Apache group format and provides information on most public mime types.

Hierarchy
  `Object`
  `MimeTypeHelper`

## Constructor Summary

MimeTypeHelper()

## Method Summary

`public static `List`` | `getExtensions`(`String` mimeType) Get the list of extensions for the given mime type.
`public static `String`` | `getFileExtension`(`String` path) Get the last most extension from a file path.
`public static `String`` | `getMajor`(`String` mimeType) Get the major portion of a mime type.
`public static `String`` | `getMimeType`(`String` ext) Get the mime type for the specified extension.
`public static `String`` | `getMimeType`(`File` file) Get the mime type for the specified file.
`public static `String`` | `getMimeTypeFromPath`(`String` path) Get the mime type for the specified file path.
`public static `String`` | `getMinor`(`String` mimeType) Get the minor portion of a mime type.
`public static `List`` | `split`(`String` str, `String` seps) Split a string on a separator and return it as a list.
`public static void` | `splitInto`(`String` str, `String` seps, `List` l) Split a string on a separator into the given list

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Detail

### MimeTypeHelper

    public MimeTypeHelper()

## Method Detail

### getExtensions(String) Method

    public static List getExtensions(String mimeType)

Get the list of extensions for the given mime type.

#### Parameters

mimeType
  the mime type.

#### Returns

the list on success, null on unknown mime type (empty list if no associated mime types).

### getFileExtension(String) Method

    public static String getFileExtension(String path)

Get the last most extension from a file path.

This can handle both UNIX and Win32 paths.

#### Parameters

path
  the file path.

#### Returns

the extension (no . included), null if none.

### getMajor(String) Method

    public static String getMajor(String mimeType)

Get the major portion of a mime type.

#### Parameters

mimeType
  the mime type.

#### Returns

the major (first) part of the mime type, null on invalid mime type.

### getMimeType(String) Method

    public static String getMimeType(String ext)

Get the mime type for the specified extension.

#### Parameters

ext
  the file extensions (no . included).

#### Returns

the mime type, or null if unknown.

### getMimeType(File) Method

    public static String getMimeType(File file)

Get the mime type for the specified file.

#### Parameters

file
  the file.

#### Returns

the mime type, or null if unknown.

Related Topics

``MimeTypeHelper.getMimeTypeFromPath(String)``

### getMimeTypeFromPath(String) Method

    public static String getMimeTypeFromPath(String path)

Get the mime type for the specified file path.

#### Parameters

path
  the file path.

#### Returns

the mime type, or null if unknown.

Related Topics

``MimeTypeHelper.getMimeType(String)``
``MimeTypeHelper.getFileExtension(String)``

### getMinor(String) Method

    public static String getMinor(String mimeType)

Get the minor portion of a mime type.

#### Parameters

mimeType
  the mime type.

#### Returns

the major (first) part of the mime type, null on invalid mime

### split(String, String) Method

    public static List split(String str,
                             String seps)

Split a string on a separator and return it as a list.

#### Parameters

str
  the string to split.

seps
  the separators (as per StringTokenizer).

#### Returns

list of elements.

### splitInto(String, String, List) Method

    public static void splitInto(String str,
                                 String seps,
                                 List l)

Split a string on a separator into the given list

#### Parameters

str
  the string to split.

seps
  the separators (as per StringTokenizer).

l
  the list.