程序包 spring.turbo.io

类 FilenameUtils

java.lang.Object
spring.turbo.io.FilenameUtils

public final class FilenameUtils extends Object
文件名处理工具
从以下版本开始:
1.0.5
作者:
应卓
  • 方法详细资料

    • normalize

      public static String normalize(String filename)
      正常化文件名
      参数:
      filename - 文件名
      返回:
      文件名
    • contact

      public static String contact(String path, @Nullable String... more)
      拼接多个path生成文件名
      参数:
      path - path
      more - 子目录
      返回:
      文件名
    • getName

      public static String getName(String fileName)
      获取文件全名
       a/b/c.txt --> c.txt
       a.txt     --> a.txt
       a/b/c     --> c
       a/b/c/    --> ""
       
      参数:
      fileName - 文件名
      返回:
      文件名
    • getBaseName

      public static String getBaseName(String fileName)
      获取文件BaseName
       a/b/c.txt --> c
       a.txt     --> a
       a/b/c     --> c
       a/b/c/    --> ""
       
      参数:
      fileName - 文件名
      返回:
      文件basename
    • getExtension

      public static String getExtension(String fileName)
      获取文件的扩展名
       foo.txt      --> "txt"
       a/b/c.jpg    --> "jpg"
       a/b.txt/c    --> ""
       a/b/c        --> ""
       
      参数:
      fileName - 文件名
      返回:
      文件扩展名
    • removeExtension

      public static String removeExtension(String fileName)
      去除扩展名
       foo.txt    --gt; foo
       a\b\c.jpg  --gt; a\b\c
       a\b\c      --gt; a\b\c
       a.b\c      --gt; a.b\c
       
      参数:
      fileName - 文件名
      返回:
      结果
    • indexOfExtension

      public static int indexOfExtension(@Nullable String fileName)
      查找扩展名的索引起点
      参数:
      fileName - 文件名
      返回:
      结果或者-1