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

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

Best Java code snippets using org.nutz.lang.Files.createDirIfNoExists (Showing top 16 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 UU32FilePool(String path) {
  this.root = Files.createDirIfNoExists(path);
}
origin: nutzam/nutz

public File createFile(String suffix) {
  String key = R.UU32();
  File dir = new File(root, key.substring(0, 2));
  Files.createDirIfNoExists(dir);
  return new File(dir, key.substring(2));
}
public void clear() {
origin: nutzam/nutz

public void clear() {
  Files.deleteDir(root);
  this.root = Files.createDirIfNoExists(root);
}
 
origin: nutzam/nutz

public File createDir() {
  if (size > 0 && cursor >= size)
    cursor = -1;
  long id = ++cursor;
  if (size > 0 && id >= size)
    Lang.makeThrow("Id (%d) is out of range (%d)", id, size);
  return Files.createDirIfNoExists(Pools.getFilePathById(home, id, null));
}
origin: nutzam/nutz

public SimpleFilePool(String homePath, long max) {
  if (log.isInfoEnabled()) {
    log.infof("Init simple-file-pool by: %s [%s]", homePath, max);
  }
  this.max = max;
  this.home = Files.createDirIfNoExists(homePath);
  this.current = 0;
}
origin: nutzam/nutz

public NutFilePool(String homePath, long size) {
  if (log.isInfoEnabled()) {
    log.infof("Init file-pool by: %s [%s]", homePath, size);
  }
  this.size = size;
  this.home = Files.createDirIfNoExists(homePath);
  if (!home.isDirectory())
    throw Lang.makeThrow(    "Path error '%s'! ,You must declare a real directory as the '%s' home folder.",
                homePath,
                this.getClass().getName());
  home = new File(Disks.normalize(homePath));
  if (log.isDebugEnabled()) {
    log.debugf("file-pool.home: '%s'", home.getAbsolutePath());
  }
  cursor = foundMax(home, home, 0);
  if (cursor < 0)
    cursor = 0;
  if (log.isInfoEnabled())
    log.infof("file-pool.cursor: %s", cursor);
}
origin: org.nutz/nutz

public UU32FilePool(String path) {
  this.root = Files.createDirIfNoExists(path);
}
origin: org.nutz/nutz

public File createFile(String suffix) {
  String key = R.UU32();
  File dir = new File(root, key.substring(0, 2));
  Files.createDirIfNoExists(dir);
  return new File(dir, key.substring(2));
}
public void clear() {
origin: nutzam/nutz-web

public static String mkDir(File root, String path) {
  if (-1 != path.indexOf(".")) {
    path = path.replaceAll("\\.", "/");
  }
  log.info("mkdir  : " + path);
  String dir = root.getAbsolutePath() + "/" + path;
  File mdir = Files.createDirIfNoExists(dir);
  if (mdir != null) {
    return mdir.getAbsolutePath();
  }
  return null;
}
origin: org.nutz/nutz

public void clear() {
  Files.deleteDir(root);
  this.root = Files.createDirIfNoExists(root);
}
 
origin: org.nutz/nutz

public File createDir() {
  if (size > 0 && cursor >= size)
    cursor = -1;
  long id = ++cursor;
  if (size > 0 && id >= size)
    Lang.makeThrow("Id (%d) is out of range (%d)", id, size);
  return Files.createDirIfNoExists(Pools.getFilePathById(home, id, null));
}
origin: org.nutz/nutz

public SimpleFilePool(String homePath, long max) {
  if (log.isInfoEnabled()) {
    log.infof("Init simple-file-pool by: %s [%s]", homePath, max);
  }
  this.max = max;
  this.home = Files.createDirIfNoExists(homePath);
  this.current = 0;
}
origin: nutzam/nutzboot

public void init() {
  if (conf.has("urule.repository.dir")) {
    String dir = conf.get("urule.repository.dir");
    dir = Files.createDirIfNoExists(dir).getAbsolutePath();
    conf.set("rule.repository.di", dir);
  }
}
origin: nutzam/nutz-web

private String doScan() {
  final StringBuilder sb = new StringBuilder();
  final HashMap<String, Boolean> paths = new HashMap<String, Boolean>();
  File home = Files.createDirIfNoExists(rsHome);
  Context context = Lang.context();
  context.set(Webs.RS, rs);
origin: org.nutz/nutz

public NutFilePool(String homePath, long size) {
  if (log.isInfoEnabled()) {
    log.infof("Init file-pool by: %s [%s]", homePath, size);
  }
  this.size = size;
  this.home = Files.createDirIfNoExists(homePath);
  if (!home.isDirectory())
    throw Lang.makeThrow(    "Path error '%s'! ,You must declare a real directory as the '%s' home folder.",
                homePath,
                this.getClass().getName());
  home = new File(Disks.normalize(homePath));
  if (log.isDebugEnabled()) {
    log.debugf("file-pool.home: '%s'", home.getAbsolutePath());
  }
  cursor = foundMax(home, home, 0);
  if (cursor < 0)
    cursor = 0;
  if (log.isInfoEnabled())
    log.infof("file-pool.cursor: %s", cursor);
}
origin: nutzam/nutz-web

log.info("\n" + Json.toJson(pc));
File root = Files.createDirIfNoExists(pc.path);
Files.createDirIfNoExists(root);
String pkgPath = "src/" + pc.pkg;
mkDir(root, "src");
org.nutz.langFilescreateDirIfNoExists

Javadoc

传入一个目录对象,如果目录不存在,则创建目录

Popular methods of Files

  • findFile
    从 CLASSPATH 下或从指定的本机器路径下寻找一个文件
  • createFileIfNoExists
    试图生成一个文件对象,如果文件不存在则创建它。 如果给出的 PATH 是相对路径 则会在 CLASSPATH 中寻找,如果未找到,则会在用户主目录中创建这个文件
  • getSuffixName
    获取文件后缀名,不包括 '.',如 'abc.gif',',则返回 'gif'
  • readBytes
    读取文件全部字节,并关闭文件
  • renameSuffix
    将文件路径后缀改名,从而生成一个新的文件路径。
  • 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

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSharedPreferences (Context)
  • runOnUiThread (Activity)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
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