2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
\r
4 * This library is free software; you can redistribute it and/or modify it under
\r
5 * the terms of the GNU Lesser General Public License as published by the Free
\r
6 * Software Foundation; either version 2.1 of the License, or (at your option)
\r
9 * This library is distributed in the hope that it will be useful, but WITHOUT
\r
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
\r
15 package com.liferay.portal.kernel.util;
\r
17 import java.io.File;
\r
19 import java.io.InputStream;
\r
22 * @author Jorge Ferrer
\r
23 * @author Brian Wing Shun Chan
\r
24 * @author Alexander Chow
\r
26 public class MimeTypesOverrideUtil {
\r
28 public static String getContentType(File file) {
\r
29 return getService().getContentType(file);
\r
33 * Determine the content type from an input stream and file name.
\r
35 * @param fileName full name or extension of file (e.g., "Test.doc",
\r
37 * @return content type if it is a supported format or an empty string if it
\r
38 * is an unsupported format
\r
40 public static String getContentType(
\r
41 InputStream inputStream, String fileName) {
\r
43 return getService().getContentType(inputStream, fileName);
\r
47 * Determine the content type from a file name.
\r
49 * @param fileName full name or extension of file (e.g., "Test.doc",
\r
51 * @return content type if it is a supported format or an empty string if it
\r
52 * is an unsupported format
\r
54 public static String getContentType(String fileName) {
\r
55 return getService().getContentType(fileName);
\r
58 public static MimeTypesOverride getService() {
\r
62 public void setService(MimeTypesOverride mimeTypes) {
\r
63 _service = mimeTypes;
\r
66 private static MimeTypesOverride _service;
\r