Here you can find the source of suffix(String mime)
Parameter | Description |
---|---|
mime | content type to find a suffix for |
public static String suffix(String mime)
//package com.java2s; /*// w ww . java2 s.com * Shredzone Commons * * Copyright (C) 2012 Richard "Shred" K?rber * http://commons.shredzone.org * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Suggests a file name suffix for the given content type. * <p> * The current implementation only detects the standard HTML image types. * * @param mime * content type to find a suffix for * @return suggested suffix, or "bin" if there is no known suffix */ public static String suffix(String mime) { // TODO: more suffixes switch (mime) { case "image/png": return "png"; case "image/jpeg": return "jpg"; case "image/gif": return "gif"; default: return "bin"; } } }