Tabnine Logo
Files.createDirIfNoExists
Code IndexAdd Tabnine 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)

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 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 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 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

  • Making http requests using okhttp
  • setRequestProperty (URLConnection)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onRequestPermissionsResult (Fragment)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • Path (java.nio.file)
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top PhpStorm plugins
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