Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jersey.multipart.file
Class DefaultMediaTypePredictor

    java.lang.Object
      com.sun.jersey.multipart.file.DefaultMediaTypePredictor

All Implemented Interfaces:
  MediaTypePredictor

    public class DefaultMediaTypePredictor

extends java.lang.Object
implements MediaTypePredictor

Default implementation of `MediaTypePredictor` that uses `DefaultMediaTypePredictor.CommonMediaTypes`.

Author:
  imran@smartitengineering.com, Paul.Sandoz@Sun.Com

Nested Class Summary
`static class` | `DefaultMediaTypePredictor.CommonMediaTypes` This enum represents file extension and MIME types of commonly used file.

Constructor Summary
`DefaultMediaTypePredictor()`

Method Summary
`static DefaultMediaTypePredictor` | `getInstance()` Get the singleton instance of this class.
`MediaType` | `getMediaTypeFromFile(java.io.File file)` Get the media type from a file name.
`MediaType` | `getMediaTypeFromFileName(java.lang.String fileName)` Get the media type from a file name.

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

Constructor Detail

### DefaultMediaTypePredictor

    public DefaultMediaTypePredictor()

Method Detail

### getMediaTypeFromFile

    public MediaType getMediaTypeFromFile(java.io.File file)

  Description copied from interface: `MediaTypePredictor`
  Get the media type from a file name.

  Specified by:
    `getMediaTypeFromFile` in interface `MediaTypePredictor`
  Parameters:
    `file` - The file from which to get the `MediaType`
  Returns:
    The `MediaType` for the give file; `null` - if file is null; "application/octet-stream" if extension not recognized.
  See Also:
    `DefaultMediaTypePredictor.CommonMediaTypes.getMediaTypeFromFileName(java.lang.String)`

### getMediaTypeFromFileName

    public MediaType getMediaTypeFromFileName(java.lang.String fileName)

  Description copied from interface: `MediaTypePredictor`
  Get the media type from a file name. If the file name extension is not recognised it will return `MediaType` for "*\/*", it will also return the same if the file is `null`.

  Specified by:
    `getMediaTypeFromFileName` in interface `MediaTypePredictor`
  Parameters:
    `fileName` - The file name from which to get the `MediaType`
  Returns:
    The `MediaType` for the give file; `null` - if file is null; "application/octet-stream" if extension not recognized.

### getInstance

    public static DefaultMediaTypePredictor getInstance()

  Get the singleton instance of this class.

  Returns:
    the singleton instance.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011 Oracle Corporation. All Rights Reserved.