Java Activation Mimetype Check init()

Here you can find the source of init()

Description

Init the mime type list

License

Apache License

Declaration

public static void init() 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright 2015 xWic group (http://www.xwic.de)
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and 
 * limitations under the License./*from w  w w.j a  v a 2 s.  c  o m*/
 *  
 *******************************************************************************/

import javax.activation.MimetypesFileTypeMap;

public class Main {
    private static final MimetypesFileTypeMap mimeTypes = new MimetypesFileTypeMap();

    /**
     * Init the mime type list
     */
    public static void init() {
        mimeTypes.addMimeTypes("application/vnd.ms-excel xls xlt");
        mimeTypes.addMimeTypes("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx");
        mimeTypes.addMimeTypes("application/msword doc dot");
        mimeTypes.addMimeTypes("application/vnd.openxmlformats-officedocument.wordprocessingml.document docx");
        mimeTypes.addMimeTypes("application/pdf pdf");
        mimeTypes.addMimeTypes("application/rtf rtf");
        mimeTypes.addMimeTypes("text/csv csv");
        mimeTypes.addMimeTypes("application/vnd.ms-powerpoint ppt pps pot");
        mimeTypes.addMimeTypes("application/vnd.ms-outlook msg");
        mimeTypes.addMimeTypes("image/png png");
        mimeTypes.addMimeTypes("image/jpeg jpg jpe jpeg");
        mimeTypes.addMimeTypes("image/gif gif");
        mimeTypes.addMimeTypes("application/zip zip");
        mimeTypes.addMimeTypes("text/plain txt");
    }
}

Related

  1. getContentType(String filePath)
  2. getContentTypeFromFileName(String fileName)
  3. getMimeType(final String filename)
  4. getMimetype(String filename)
  5. getMimeTypeForFileName(String filename)
  6. initFileTypeMap()
  7. isFileImage(String fileName)
  8. isImage(String fileName, boolean output)
  9. isMimeType(String a)