All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jeesuite.filesystem.utils.FilePathHelper Maven / Gradle / Ivy

There is a newer version: 1.3.6
Show newest version
/**
 * 
 */
package com.jeesuite.filesystem.utils;

import com.jeesuite.filesystem.FileType;

/**
 * 
 * @description 
* @author vakin * @date 2017年1月5日 */ public class FilePathHelper { public static FileType parseFileType(String filePath){ if(filePath.contains("/")){ filePath = filePath.substring(filePath.lastIndexOf("/")); } filePath = filePath.split("\\?")[0]; if(filePath.contains(".")){ String suffix = filePath.substring(filePath.lastIndexOf(".") + 1); return FileType.valueOf2(suffix); } return null; } public static void main(String[] args) { System.out.println(parseFileType("http:www.ssss.com/cccc/123.png?xxx")); System.out.println(parseFileType("123.png")); System.out.println(parseFileType("http:www.ssss.com/cccc/dtgh4r4tt/")); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy