com.amazonaws.services.s3.internal

## クラス Mimetypes

- java.lang.Object
- - com.amazonaws.services.s3.internal.Mimetypes

-     public class Mimetypes
      extends java.lang.Object

  Utility class that maintains a listing of known Mimetypes, and determines the mimetype of files based on file extensions.

  This class is obtained with the {#link `getInstance()` method that recognizes loaded mime types from the file `mime.types` if this file is available at the root of the classpath. The mime.types file format, and most of the content, is taken from the Apache HTTP server's mime.types file.

  The format for mime type setting documents is: `mimetype + extension (+ extension)*`. Any blank lines in the file are ignored, as are lines starting with `#` which are considered comments. Lines that have a mimetype but no associated extensions are also ignored.

- - ### フィールドの概要

    フィールド
    修飾子とタイプ | フィールドと説明
    --- | ---
    `static java.lang.String` | `MIMETYPE_GZIP` The default gzip mimetype: application/x-gzip
    `static java.lang.String` | `MIMETYPE_HTML` The default HTML mimetype: text/html
    `static java.lang.String` | `MIMETYPE_OCTET_STREAM` The default binary mimetype: application/octet-stream
    `static java.lang.String` | `MIMETYPE_XML` The default XML mimetype: application/xml

  - ### メソッドの概要

    メソッド
    修飾子とタイプ | メソッドと説明
    --- | ---
    `static Mimetypes` | `getInstance()` Loads MIME type info from the file 'mime.types' in the classpath, if it's available.
    `java.lang.String` | `getMimetype(java.io.File file)` Determines the mimetype of a file by looking up the file's extension in an internal listing to find the corresponding mime type.
    `java.lang.String` | `getMimetype(java.lang.String fileName)` Determines the mimetype of a file by looking up the file's extension in an internal listing to find the corresponding mime type.
    `void` | `loadAndReplaceMimetypes(java.io.InputStream is)` Reads and stores the mime type setting corresponding to a file extension, by reading text from an InputStream.

    - ### クラスから継承されたメソッド java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### フィールドの詳細

    - #### MIMETYPE_XML

          public static final java.lang.String MIMETYPE_XML

      The default XML mimetype: application/xml
      関連項目:
        定数フィールド値

    - #### MIMETYPE_HTML

          public static final java.lang.String MIMETYPE_HTML

      The default HTML mimetype: text/html
      関連項目:
        定数フィールド値

    - #### MIMETYPE_OCTET_STREAM

          public static final java.lang.String MIMETYPE_OCTET_STREAM

      The default binary mimetype: application/octet-stream
      関連項目:
        定数フィールド値

    - #### MIMETYPE_GZIP

          public static final java.lang.String MIMETYPE_GZIP

      The default gzip mimetype: application/x-gzip
      関連項目:
        定数フィールド値

  - ### メソッドの詳細

    - #### getInstance

          public static Mimetypes getInstance()

      Loads MIME type info from the file 'mime.types' in the classpath, if it's available.

    - #### loadAndReplaceMimetypes

          public void loadAndReplaceMimetypes(java.io.InputStream is)
                                       throws java.io.IOException

      Reads and stores the mime type setting corresponding to a file extension, by reading text from an InputStream. If a mime type setting already exists when this method is run, the mime type value is replaced with the newer one.
      パラメータ:
        `is` -
      例外:
        `java.io.IOException`

    - #### getMimetype

          public java.lang.String getMimetype(java.lang.String fileName)

      Determines the mimetype of a file by looking up the file's extension in an internal listing to find the corresponding mime type. If the file has no extension, or the extension is not available in the listing contained in this class, the default mimetype `application/octet-stream` is returned.

      A file extension is one or more characters that occur after the last period (.) in the file's name. If a file has no extension, Guesses the mimetype of file data based on the file's extension.

      パラメータ:
        `fileName` - The name of the file whose extension may match a known mimetype.
      戻り値:
        The file's mimetype based on its extension, or a default value of `application/octet-stream` if a mime type value cannot be found.

    - #### getMimetype

          public java.lang.String getMimetype(java.io.File file)

      Determines the mimetype of a file by looking up the file's extension in an internal listing to find the corresponding mime type. If the file has no extension, or the extension is not available in the listing contained in this class, the default mimetype `application/octet-stream` is returned.

      A file extension is one or more characters that occur after the last period (.) in the file's name. If a file has no extension, Guesses the mimetype of file data based on the file's extension.

      パラメータ:
        `file` - the file whose extension may match a known mimetype.
      戻り値:
        the file's mimetype based on its extension, or a default value of `application/octet-stream` if a mime type value cannot be found.