soot.options.Options.output_jar()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(146)

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

Options.output_jar介绍

暂无

代码示例

代码示例来源:origin: Sable/soot

public static String createDirIfNotExist(String dirName) {
 File dir = new File(dirName);
 if (!dir.exists()) {
  try {
   if (!Options.v().output_jar()) {
    dir.mkdirs();
   }
  } catch (SecurityException se) {
   logger.debug("Unable to create " + dirName);
   throw new CompilationDeathException(CompilationDeathException.COMPILATION_ABORTED);
  }
 }
 return dirName;
}

代码示例来源:origin: Sable/soot

private void setupJAR() {
 if (Options.v().output_jar()) {
  String outFileName = SourceLocator.v().getOutputJarName();
  try {
   jarFile = new JarOutputStream(new FileOutputStream(outFileName));
  } catch (IOException e) {
   throw new CompilationDeathException("Cannot open output Jar file " + outFileName);
  }
 } else {
  jarFile = null;
 }
}

代码示例来源:origin: Sable/soot

/**
 * If {@link Options#v()#output_jar()} is set, returns the name of the jar file to which the output will be written. The
 * name of the jar file can be given with the -output-dir option or a default will be used. Also ensures that all
 * directories in the path exist.
 *
 * @return the name of the Jar file to which outputs are written
 */
public String getOutputJarName() {
 if (!Options.v().output_jar()) {
  return "";
 }
 File dir;
 if (Options.v().output_dir().length() == 0) {
  // Default if -output-dir was not set
  dir = new File("sootOutput/out.jar");
 } else {
  dir = new File(Options.v().output_dir());
  // If a Jar name was not given, then supply default
  if (!dir.getPath().endsWith(".jar")) {
   dir = new File(dir.getPath(), "out.jar");
  }
 }
 ensureDirectoryExists(dir.getParentFile());
 return dir.getPath();
}

代码示例来源:origin: Sable/soot

private ZipOutputStream getZipOutputStream() throws IOException {
 if (Options.v().output_jar()) {
  LOGGER.info("Writing JAR to \"{}\"", Options.v().output_dir());
  return PackManager.v().getJarFile();
 }
 final String name = originalApk == null ? "out.apk" : originalApk.getName();
 if (originalApk == null) {
  LOGGER.warn("Setting output file name to \"{}\" as original APK has not been found.", name);
 }
 final Path outputFile = Paths.get(SourceLocator.v().getOutputDir(), name);
 if (Files.exists(outputFile, LinkOption.NOFOLLOW_LINKS)) {
  if (!Options.v().force_overwrite()) {
   throw new CompilationDeathException("Output file \"" + outputFile + "\" exists. Not overwriting.");
  }
  try {
   Files.delete(outputFile);
  } catch (IOException exception) {
   throw new IllegalStateException("Removing \"" + outputFile + "\" failed. Not writing out anything.", exception);
  }
 }
 LOGGER.info("Writing APK to \"{}\".", outputFile);
 return new ZipOutputStream(Files.newOutputStream(outputFile, StandardOpenOption.CREATE_NEW));
}

代码示例来源:origin: Sable/soot

if (!Options.v().output_jar()) {
 b.append(getOutputDir());

代码示例来源:origin: Sable/soot

public void print() {
 try {
  if (Options.v().output_jar()
    || (originalApk != null && Options.v().output_format() != Options.output_format_force_dex)) {
   printZip();
  } else {
   final String outputDir = SourceLocator.v().getOutputDir();
   LOGGER.info("Writing dex files to \"{}\" folder.", outputDir);
   dexBuilder.writeTo(outputDir);
  }
 } catch (IOException e) {
  throw new CompilationDeathException("I/O exception while printing dex", e);
 }
}

代码示例来源:origin: ibinti/bugvm

public String getOutputDir() {
  String ret = Options.v().output_dir();
  if( ret.length() == 0 ) ret = "sootOutput";
  File dir = new File(ret);
  if (!dir.exists()) {
    try {
      if( !Options.v().output_jar() ) {
        dir.mkdirs();
      }
    } catch (SecurityException se) {
      G.v().out.println("Unable to create " + ret);
      throw new CompilationDeathException(CompilationDeathException.COMPILATION_ABORTED);
    }
  }
  return ret;
}

代码示例来源:origin: ibinti/bugvm

public String getFileNameFor(SootClass c, int rep) {
  if (rep == Options.output_format_none)
    return null;
  StringBuffer b = new StringBuffer();
  if( !Options.v().output_jar() ) {
    b.append(getOutputDir());
  }
  if ((b.length() > 0) && (b.charAt(b.length() - 1) != File.separatorChar))
    b.append(File.separatorChar);
  if (rep != Options.output_format_dava) {
    if(rep == Options.output_format_class) {
      b.append(c.getName().replace('.', File.separatorChar));
    } else if(rep == Options.output_format_template) {
      b.append(c.getName().replace('.', '_'));
      b.append("_Maker");
    } else {
      b.append(c.getName());
    }
    b.append(getExtensionFor(rep));
    return b.toString();
  }
  return getDavaFilenameFor(c, b);
}

代码示例来源:origin: com.bugvm/bugvm-soot

public String getOutputDir() {
  String ret = Options.v().output_dir();
  if( ret.length() == 0 ) ret = "sootOutput";
  File dir = new File(ret);
  if (!dir.exists()) {
    try {
      if( !Options.v().output_jar() ) {
        dir.mkdirs();
      }
    } catch (SecurityException se) {
      G.v().out.println("Unable to create " + ret);
      throw new CompilationDeathException(CompilationDeathException.COMPILATION_ABORTED);
    }
  }
  return ret;
}

代码示例来源:origin: com.bugvm/bugvm-soot

public String getFileNameFor(SootClass c, int rep) {
  if (rep == Options.output_format_none)
    return null;
  StringBuffer b = new StringBuffer();
  if( !Options.v().output_jar() ) {
    b.append(getOutputDir());
  }
  if ((b.length() > 0) && (b.charAt(b.length() - 1) != File.separatorChar))
    b.append(File.separatorChar);
  if (rep != Options.output_format_dava) {
    if(rep == Options.output_format_class) {
      b.append(c.getName().replace('.', File.separatorChar));
    } else if(rep == Options.output_format_template) {
      b.append(c.getName().replace('.', '_'));
      b.append("_Maker");
    } else {
      b.append(c.getName());
    }
    b.append(getExtensionFor(rep));
    return b.toString();
  }
  return getDavaFilenameFor(c, b);
}

相关文章

微信公众号

最新文章

更多