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

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

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

FileUtil.readFile介绍

[英]Preserves the line breaks of the original file. As such, it can be used for calculating digests.
[中]保留原始文件的换行符。因此,它可用于计算摘要。

代码示例

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

public static String readFile(String _p) throws IOException {
  return FileUtil.readFile(Paths.get(_p));
}

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

@Override
public void loadPayloadFromDisk() throws IOException {
  if(this.payloadFile!=null)
    this.payload = FileUtil.readFile(this.getPayloadPath());
}

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

@SuppressWarnings("unchecked")
  public T read(Path _path) {
    T object = null;
    if(FileUtil.isAccessibleFile(_path)) {
      try {
        final String json = FileUtil.readFile(_path);
        object = (T)JacksonUtil.asObject(json, this.clazz);
      } catch (IOException e) {
        log.error("Error reading from file [" + _path + "]: " + e.getMessage(), e);
      } catch (ClassCastException e) {
        log.error("Error reading from file [" + _path + "]: " + e.getMessage(), e);
      } catch (Exception e) {
        log.error("Error reading from file [" + _path + "]: " + e.getMessage(), e);
      }
    }
    return object;
  }    
}

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

final String error_msg = FileUtil.readFile(err);
log.error("Error calling [python " + StringUtil.join(list, " ") + "]: " + error_msg);

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

final String error_msg = FileUtil.readFile(this.errFile);
log.error("Error running [" + this.getCommand() + "]: " + error_msg);

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

final String error_msg = FileUtil.readFile(err);
throw new ProcessWrapperException(error_msg);

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

JarJarDiff.main(args);
log.info("Write diff to [" + diff_xml.toPath() + "]");
return new ResponseEntity<String>(FileUtil.readFile(diff_xml.toPath()), HttpStatus.OK);

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

this.searchDownloadInfo(packages, FileUtil.readFile(download_info));

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

splitLine[10] = splitLine[10].replace('/', File.separator.charAt(0));
  vulnAst = FileUtil.readFile(baseFolder+splitLine[10]);
} catch (FileNotFoundException e) {
  BugLibManager.log.error("Couldn't find file [" +splitLine[10] + "]");
    splitLine[11] = splitLine[11].replace('/', File.separator.charAt(0));
  fixedAst = FileUtil.readFile(baseFolder+splitLine[11]);
} catch (FileNotFoundException e) {
  BugLibManager.log.error("Couldn't find file [" +splitLine[11] + "]");
    BugLibManager.log.error("Tested-AST affected by previous bug: vuln AST was saved as tested one for bug[" +bugChangeList.getBugId() + "]");
  testedAst = FileUtil.readFile(baseFolder+splitLine[12]);
} catch (FileNotFoundException e) {
  BugLibManager.log.error("Couldn't find file [" +splitLine[12] + "]");

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

/**
 * Parses the output of pip list, and instantiates {@link PipInstalledPackage} for every installed pip package.
 * @param _file
 * @return
 * @throws IOException
 */
private Set<PipInstalledPackage> deserializePipListOutput(Path _file) throws IOException {
  // Deserialize
  final String json = FileUtil.readFile(_file);
  final PipPackageJson[] packs = (PipPackageJson[])JacksonUtil.asObject(json, PipPackageJson[].class);
  // Create set
  final Set<PipInstalledPackage> set = new HashSet<PipInstalledPackage>();
  for(PipPackageJson p: packs) {
    if(this.ignorePackage(p.getName())) {
      log.warn("Package [" + p.getName() + "] not added as installed package");
    } else {
      set.add(new PipInstalledPackage(p.getName(), p.getVersion()));
    }    
  }
  return set;
}

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

public PipInstalledPackage call() throws ProcessWrapperException, IOException {
    // Make download dir
    //final Path download_dir = Paths.get(logDir.toString(), "pip-download");
    final Path download_dir = FileUtil.createTmpDir(this.pack.getName() + "-");
    // Download all deps
    ProcessWrapper pw = new ProcessWrapper();
    pw.setCommand(pathToPip, "download", "-d", download_dir.toString(), "--no-cache-dir", this.pack.getName()+"=="+this.pack.getVersion());
    pw.setPath(logDir);
    pw.run();
    final Path download_info = pw.getOutFile();
    // Enrich with download info
    searchDownloadInfo(this.pack, FileUtil.readFile(download_info));
    return this.pack;
  }
}

相关文章