com.sap.psr.vulas.shared.util.FileUtil.createDirectory()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中com.sap.psr.vulas.shared.util.FileUtil.createDirectory()方法的一些代码示例,展示了FileUtil.createDirectory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.createDirectory()方法的具体详情如下:
包路径:com.sap.psr.vulas.shared.util.FileUtil
类名称:FileUtil
方法名:createDirectory

FileUtil.createDirectory介绍

暂无

代码示例

代码示例来源:origin: SAP/vulnerability-assessment-tool

private void writeToDisk(String _file, Graph<ConstructId> _g) {
  try {
    // Create all parent dirs
    final Path p = Paths.get(_file);
    FileUtil.createDirectory(p.getParent());
    // Write object
    final File f = new File(_file);
    try (final ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(f))) {
      oos.writeObject(_g);
      log.info("Wrote call graph with [" + _g.getNumberOfNodes() + "] nodes to [" + _file + "]");
    }
  } catch (IOException ioe) {
    log.error("I/O error when writing object to [" + _file + "]: " + ioe.getMessage(), ioe);
  }
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

/**
 * Creates if necessary and returns the temporary directory to be used by Vulas. This is either the directory
 * indicated by the configuration setting TMP_DIR (if any) or the OS' temporary directory.
 */
public Path getTmpDir() {
  Path p = null;
  if(!this.isEmpty(TMP_DIR))
    p = Paths.get(cfg.getString(TMP_DIR));
  else
    p = Paths.get(System.getProperty("java.io.tmpdir"));
  // Create if necessary
  FileUtil.createDirectory(p);
  return p;
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

public static Path getPath(String _path, boolean _create) {
  if(_path==null || _path.equals(""))
    return null;
  else {
    final Path p = Paths.get(_path).toAbsolutePath();
    if(FileUtil.isAccessibleFile(p) || FileUtil.isAccessibleDirectory(p)) {
      return p;
    } else if(!p.toFile().exists() && _create) {
      FileUtil.createDirectory(p);
      return p;
    } else {
      FileUtil.log.warn("Path [" + _path + "] is neither an accessible file nor an accessible directory, hence, will be ignored");
      return null;
    }            
  }
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

/**
 * Returns the configuration setting for the given key as {@link Path}. If no such setting exists, the tmp directory
 * will be returned.
 * @param _key
 * @return
 */
public Path getDir(String _key) {
  Path p = null;
  if(!this.isEmpty(_key))
    p = Paths.get(this.getConfiguration().getString(_key));
  else
    p = this.getTmpDir();
  // Create if necessary
  FileUtil.createDirectory(p);
  return p;
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

FileUtil.createDirectory(download_dir);

代码示例来源:origin: SAP/vulnerability-assessment-tool

try {
  p = Paths.get(VulasConfiguration.getGlobal().getTmpDir().toString(), this.javaId.getJavaPackageId().getQualifiedName().replace('.','/'), this.javaId.getName().replace('<', '_').replace('>','_') + ".class");
  FileUtil.createDirectory(p.getParent());
  FileUtil.writeToFile(p.toFile(), this.bytes);
} catch(IOException e) {

代码示例来源:origin: SAP/vulnerability-assessment-tool

try {
  p = Paths.get(VulasConfiguration.getGlobal().getTmpDir().toString(), _jid.getJavaPackageId().getQualifiedName().replace('.','/'), _jid.getDefinitionContext().getName() + "." + _jid.getName().replace('<', '_').replace('>','_') + ".java");
  FileUtil.createDirectory(p.getParent());
  FileUtil.writeToFile(p.toFile(), ClassVisitor.prettyPrint(source_code.toString()));

相关文章