Tabnine Logo
Files.renameSuffix
Code IndexAdd Tabnine to your IDE (free)

How to use
renameSuffix
method
in
org.nutz.lang.Files

Best Java code snippets using org.nutz.lang.Files.renameSuffix (Showing top 6 results out of 315)

origin: nutzam/nutz

/**
 * 将文件后缀改名,从而生成一个新的文件对象。但是并不在磁盘上创建它
 * 
 * @param f
 *            文件
 * @param suffix
 *            新后缀, 比如 ".gif" 或者 ".jpg"
 * @return 新文件对象
 */
public static File renameSuffix(File f, String suffix) {
  if (null == f || null == suffix || suffix.length() == 0)
    return f;
  return new File(renameSuffix(f.getAbsolutePath(), suffix));
}
origin: nutzam/nutz

path = "/WEB-INF"
    + (path.startsWith("/") ? "" : "/")
    + Files.renameSuffix(path, ext);
origin: org.nutz/nutz

/**
 * 将文件后缀改名,从而生成一个新的文件对象。但是并不在磁盘上创建它
 * 
 * @param f
 *            文件
 * @param suffix
 *            新后缀, 比如 ".gif" 或者 ".jpg"
 * @return 新文件对象
 */
public static File renameSuffix(File f, String suffix) {
  if (null == f || null == suffix || suffix.length() == 0)
    return f;
  return new File(renameSuffix(f.getAbsolutePath(), suffix));
}
origin: httl/httl

  protected String getTemplatePath(String path, HttpServletRequest request) {
    String ext = WebEngine.getTemplateSuffix();
    if (Strings.isBlank(path)) { // 空路径,采用默认规则
      path = Files.renameSuffix(Mvcs.getRequestPath(request), ext);
      if (! path.startsWith("/")) {
        path = "/" + path;
      }
    } else if (path.charAt(0) == '/') { // 绝对路径 : 以 '/' 开头的路径不增加 '/WEB-INF'
      if (! path.toLowerCase().endsWith(ext)) {
        path += ext;
      }
    } else { // 包名形式的路径
      path = path.replace('.', '/') + ext;
    }
    return path;
  }
}
origin: nutzam/nutzboot

private String getPath(String path) {
  StringBuffer sb = new StringBuffer();
  // 空路径,采用默认规则
  if (Strings.isBlank(path)) {
    sb.append(Mvcs.getServletContext().getRealPath(freeMarkerConfigurer.getPrefix()));
    sb.append((path.startsWith("/") ? "" : "/"));
    sb.append(Files.renameSuffix(path, getExt()));
  }
  // 绝对路径 : 以 '/' 开头的路径不增加 '/WEB-INF'
  else if (path.charAt(0) == '/') {
    String ext = getExt();
    sb.append(path);
    if (!path.toLowerCase().endsWith(ext))
      sb.append(ext);
  }
  // 包名形式的路径
  else {
    sb.append(path.replace('.', '/'));
    sb.append(getExt());
  }
  return sb.toString();
}
origin: org.nutz/nutz

path = "/WEB-INF"
    + (path.startsWith("/") ? "" : "/")
    + Files.renameSuffix(path, ext);
org.nutz.langFilesrenameSuffix

Javadoc

将文件后缀改名,从而生成一个新的文件对象。但是并不在磁盘上创建它

Popular methods of Files

  • findFile
    从 CLASSPATH 下或从指定的本机器路径下寻找一个文件
  • createDirIfNoExists
    试图生成一个目录对象,如果文件不存在则创建它。 如果给出的 PATH 是相对路径 则会在 CLASSPATH 中寻找,如果未找到,则会在用户主目录中创建这个目录
  • createFileIfNoExists
    试图生成一个文件对象,如果文件不存在则创建它。 如果给出的 PATH 是相对路径 则会在 CLASSPATH 中寻找,如果未找到,则会在用户主目录中创建这个文件
  • getSuffixName
    获取文件后缀名,不包括 '.',如 'abc.gif',',则返回 'gif'
  • readBytes
    读取文件全部字节,并关闭文件
  • write
    将内容写到一个文件内,内容对象可以是: * InputStream - 按二进制方式写入 * byte[] - 按二进制方式写入 * Reader - 按 UTF-8 方式写入 * 其他对象被
  • cleanAllFolderInSubFolderes
    将一个目录下的特殊名称的目录彻底删除,比如 '.svn' 或者 '.cvs'
  • deleteFile
    删除一个文件
  • findFileAsStream
    获取输出流
  • getName
  • makeDir
    创建新目录,如果父目录不存在,也一并创建。可接受 null 参数
  • read
    读取 UTF-8 文件全部内容
  • makeDir,
  • read,
  • checkFile,
  • clearDir,
  • copy,
  • copyDir,
  • copyFile,
  • copyOnWrite,
  • createNewFile

Popular in Java

  • Start an intent from android
  • getExternalFilesDir (Context)
  • getContentResolver (Context)
  • getResourceAsStream (ClassLoader)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • JComboBox (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now