Codota Logo
Files.createNewFile
Code IndexAdd Codota to your IDE (free)

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

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: nutzam/nutz

public File returnFile(long fId, String suffix) {
  File f = Pools.getFileById(home, fId, suffix);
  if (!f.exists())
    try {
      Files.createNewFile(f);
    }
    catch (IOException e) {
      throw Lang.wrapThrow(e);
    }
  return f;
}
origin: nutzam/nutz

public synchronized File returnFile(long fId, String suffix) {
  File re = _F(fId, suffix);
  if (!re.exists())
    try {
      Files.createNewFile(re);
    }
    catch (IOException e) {
      throw Lang.wrapThrow(e);
    }
  return re;
}
origin: nutzam/nutz

public synchronized File createFile(String suffix) {
  File f = _F(current++, suffix);
  if (current > max)
    current = 0;
  if (!f.exists())
    try {
      Files.createNewFile(f);
    }
    catch (IOException e) {
      throw Lang.wrapThrow(e);
    }
  return f;
}
origin: nutzam/nutz

public File createFile(String suffix) {
  if (size > 0 && cursor >= size-1)
    cursor = -1;
  long id = ++cursor;
  File re = Pools.getFileById(home, id, suffix);
  if (!re.exists())
    try {
      Files.createNewFile(re);
    }
    catch (IOException e) {
      throw Lang.wrapThrow(e);
    }
  return re;
}
origin: nutzam/nutz

/**
 * 如果文件对象不存在,则创建它
 * 
 * @param f
 *            文件对象
 * @return 传入的文件对象,以便为调用者省略一行代码
 */
public static File createFileIfNoExists(File f) {
  if (null == f)
    return f;
  if (!f.exists())
    try {
      Files.createNewFile(f);
    }
    catch (IOException e) {
      throw Lang.wrapThrow(e);
    }
  if (!f.isFile())
    throw Lang.makeThrow("'%s' should be a file!", f);
  return f;
}
origin: nutzam/nutz

/**
 * 试图生成一个文件对象,如果文件不存在则创建它。 如果给出的 PATH 是相对路径 则会在 CLASSPATH
 * 中寻找,如果未找到,则会在用户主目录中创建这个文件
 * 
 * @param path
 *            文件路径,可以以 ~ 开头,也可以是 CLASSPATH 下面的路径
 * @return 文件对象
 * @throws IOException
 *             创建失败
 */
public static File createFileIfNoExists(String path) throws IOException {
  String thePath = Disks.absolute(path);
  if (null == thePath)
    thePath = Disks.normalize(path);
  File f = new File(thePath);
  if (!f.exists())
    Files.createNewFile(f);
  if (!f.isFile())
    throw Lang.makeThrow("'%s' should be a file!", path);
  return f;
}
origin: nutzam/nutz

  return false;
if (!target.exists())
  if (!createNewFile(target))
    return false;
origin: nutzam/nutz

Files.createNewFile(f);
origin: nutzam/nutz

Files.createNewFile(f);
origin: org.nutz/nutz

public File returnFile(long fId, String suffix) {
  File f = Pools.getFileById(home, fId, suffix);
  if (!f.exists())
    try {
      Files.createNewFile(f);
    }
    catch (IOException e) {
      throw Lang.wrapThrow(e);
    }
  return f;
}
origin: org.nutz/nutz

public synchronized File returnFile(long fId, String suffix) {
  File re = _F(fId, suffix);
  if (!re.exists())
    try {
      Files.createNewFile(re);
    }
    catch (IOException e) {
      throw Lang.wrapThrow(e);
    }
  return re;
}
origin: org.nutz/nutz

public synchronized File createFile(String suffix) {
  File f = _F(current++, suffix);
  if (current > max)
    current = 0;
  if (!f.exists())
    try {
      Files.createNewFile(f);
    }
    catch (IOException e) {
      throw Lang.wrapThrow(e);
    }
  return f;
}
origin: org.nutz/nutz

public File createFile(String suffix) {
  if (size > 0 && cursor >= size-1)
    cursor = -1;
  long id = ++cursor;
  File re = Pools.getFileById(home, id, suffix);
  if (!re.exists())
    try {
      Files.createNewFile(re);
    }
    catch (IOException e) {
      throw Lang.wrapThrow(e);
    }
  return re;
}
origin: org.nutz/nutz

/**
 * 如果文件对象不存在,则创建它
 * 
 * @param f
 *            文件对象
 * @return 传入的文件对象,以便为调用者省略一行代码
 */
public static File createFileIfNoExists(File f) {
  if (null == f)
    return f;
  if (!f.exists())
    try {
      Files.createNewFile(f);
    }
    catch (IOException e) {
      throw Lang.wrapThrow(e);
    }
  if (!f.isFile())
    throw Lang.makeThrow("'%s' should be a file!", f);
  return f;
}
origin: org.nutz/nutz

/**
 * 试图生成一个文件对象,如果文件不存在则创建它。 如果给出的 PATH 是相对路径 则会在 CLASSPATH
 * 中寻找,如果未找到,则会在用户主目录中创建这个文件
 * 
 * @param path
 *            文件路径,可以以 ~ 开头,也可以是 CLASSPATH 下面的路径
 * @return 文件对象
 * @throws IOException
 *             创建失败
 */
public static File createFileIfNoExists(String path) throws IOException {
  String thePath = Disks.absolute(path);
  if (null == thePath)
    thePath = Disks.normalize(path);
  File f = new File(thePath);
  if (!f.exists())
    Files.createNewFile(f);
  if (!f.isFile())
    throw Lang.makeThrow("'%s' should be a file!", path);
  return f;
}
origin: org.nutz/nutz

  return false;
if (!target.exists())
  if (!createNewFile(target))
    return false;
origin: org.nutz/nutz

Files.createNewFile(f);
origin: org.nutz/nutz

Files.createNewFile(f);
org.nutz.langFilescreateNewFile

Javadoc

创建新文件,如果父目录不存在,也一并创建。可接受 null 参数

Popular methods of Files

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

Popular in Java

  • Start an intent from android
  • setContentView (Activity)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • String (java.lang)
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now