Scans a file and prints out useful information.
This utility reads from standard input, and parses
the binary contents of the RPM file.

@param args command line arguements
@throws Exception if an error occurs while
reading the RPM file or it's contents
320766
public static void main( String[] args) throws Exception {
	    InputStream fios = new FileInputStream ( args[0] );
		ReadableChannelWrapper in = new ReadableChannelWrapper( Channels.newChannel( fios));
        Scanner scanner = new Scanner(System.out);
        Format format = scanner.run(in);
		scanner.log( format.toString());
      Header rpmHeader = format.getHeader();
      scanner.log("Payload compression: "+rpmHeader.getEntry(HeaderTag.PAYLOADCOMPRESSOR));
		InputStream uncompressed = Util.openPayloadStream(rpmHeader, fios);
		in = new ReadableChannelWrapper( Channels.newChannel( uncompressed));
		CpioHeader header;
		int total = 0;
		do {
			header = new CpioHeader();
			total = header.read( in, total);
            scanner.log(header.toString());
			final int skip = header.getFileSize();
			if ( uncompressed.skip( skip) != skip) throw new RuntimeException( "Skip failed.");
			total += header.getFileSize();
		} while ( !header.isLast());
	}
1183692
public static void main(String[] args) throws Exception {

		final List<String> arguments = new ArrayList<String>(args.length);

		final Settings settings = new Settings();
		final PartialCmdLineParser parser = new PartialCmdLineParser(settings);
		int position = 0;

		while (position < args.length) {
			final int consumed = parser.parseArgument(args, position);
			if (consumed == 0) {
				arguments.add(args[position++]);
			} else {
				position += consumed;
			}
		}

		if (!arguments.contains(JsonixPlugin.OPTION)) {
			arguments.add(JsonixPlugin.OPTION);
		}

		if (!arguments.contains("-extension")) {
			arguments.add("-extension");
		}

		// TODO
		arguments.add("-disableXmlSecurity");
		// TODO
		System.setProperty("javax.xml.accessExternalSchema", "all");
		// TODO
		System.setProperty("javax.xml.accessExternalDTD", "all");

		File targetDirectory = settings.getTargetDirectory();

		if (targetDirectory == null) {
			targetDirectory = new File(".");
		}

		if (!targetDirectory.exists()) {
			targetDirectory.mkdirs();
		}

		arguments.add("-d");
		arguments.add(targetDirectory.getAbsolutePath());

		final Options options = new Options();

		options.parseArguments(arguments.toArray(new String[arguments.size()]));

		new JsonixMain(settings, options).execute();
	}
1323872
public static void main(String[] args) throws Exception {
        String input = args[0];
        File outputFile = new File(input.replace(".zip", "") + ".serialized.xz");

        // Get the base name
        FileOutputStream fos = new FileOutputStream(outputFile);
        LZMA2Options options = new LZMA2Options(9);

        XZOutputStream xzo = new XZOutputStream(fos, options);
        ObjectOutputStream oos = new ObjectOutputStream(xzo);

        BundleSerializer ml = new BundleSerializer();
        ml.loadDocuments(input);
        oos.writeObject(ml.toStore);
        oos.flush();
        oos.close();
    }
619607
public static void main(String[] args) throws Exception {
    Options options = new Options();
    HelpFormatter hf = new HelpFormatter();
    hf.setWidth(100);
    options.addOption(
        Option.builder("i")
            .argName("in_path")
            .longOpt("input-file")
            .hasArg()
            .required()
            .desc("path to target jar/aar file")
            .build());
    options.addOption(
        Option.builder("p")
            .argName("pkg_name")
            .longOpt("package")
            .hasArg()
            .desc("qualified package name")
            .build());
    options.addOption(
        Option.builder("o")
            .argName("out_path")
            .longOpt("output-file")
            .hasArg()
            .required()
            .desc("path to processed jar/aar file")
            .build());
    options.addOption(
        Option.builder("h")
            .argName("help")
            .longOpt("help")
            .desc("print usage information")
            .build());
    options.addOption(
        Option.builder("d")
            .argName("debug")
            .longOpt("debug")
            .desc("print debug information")
            .build());
    options.addOption(
        Option.builder("v").argName("verbose").longOpt("verbose").desc("set verbosity").build());
    try {
      CommandLine line = new DefaultParser().parse(options, args);
      if (line.hasOption('h')) {
        hf.printHelp(appName, options, true);
        return;
      }
      String jarPath = line.getOptionValue('i');
      String pkgName = line.getOptionValue('p', "");
      String outPath = line.getOptionValue('o');
      boolean debug = line.hasOption('d');
      boolean verbose = line.hasOption('v');
      if (!pkgName.isEmpty()) {
        pkgName = "L" + pkgName.replaceAll("\\.", "/");
      }
      DefinitelyDerefedParamsDriver.run(jarPath, pkgName, outPath, debug, verbose);
      if (!new File(outPath).exists()) {
        System.out.println("Could not write jar file: " + outPath);
      }
    } catch (ParseException pe) {
      hf.printHelp(appName, options, true);
    }
  }
900068
static public void main(String ... args) throws Exception {
        FileInputStream fin = new FileInputStream(args[0]);
        XMLReader<Sample> reader = new XMLReader<Sample>();
        
        for( Map<String,Object> map : reader.read(fin, Sample.class) ) {
            System.out.println("Next...");
            for( Map.Entry<String,Object> entry : map.entrySet() ) {
                System.out.println("\t" + entry.getKey() + " (" + (entry.getValue() != null ? entry.getValue().getClass().getName() : "") + "): " + entry.getValue());
            }
        }
    }
709656
public static void main(String[] args) throws Exception {
        for (String arg : args) {
            Class clazz = Class.forName(arg);
            System.out.println("Examining: " + clazz.getName());
            try {
                examine(clazz);
                System.out.println("Passed");
            } catch (MalformedTypeException e) {
                System.out.println("Malformed type: " + e.getMalformedType().getName());
                for (String message : e.getMessages()) {
                    System.out.println(message);
                }
            }
        }
    }
766586
public static void main(final String[] args) {
        Switch about = new Switch("a", "about", "display about message");
        Switch help = new Switch("h", "help", "display help message");
        FileListArgument inputFastqFiles = new FileListArgument("i", "input-fastq-files", "list of FASTQ input files", true);
        FileArgument outputFastqFile = new FileArgument("o", "output-fastq-file", "FASTQ output file, default stdout", false);

        ArgumentList arguments = new ArgumentList(about, help, inputFastqFiles, outputFastqFile);
        CommandLine commandLine = new CommandLine(args);

        MergeFastq mergeFastq = null;
        try {
            CommandLineParser.parse(commandLine, arguments);
            if (about.wasFound()) {
                About.about(System.out);
                System.exit(0);
            }
            if (help.wasFound()) {
                Usage.usage(USAGE, null, commandLine, arguments, System.out);
                System.exit(0);
            }
            mergeFastq = new MergeFastq(inputFastqFiles.getValue(), outputFastqFile.getValue());
        }
        catch (CommandLineParseException e) {
            if (about.wasFound()) {
                About.about(System.out);
                System.exit(0);
            }
            if (help.wasFound()) {
                Usage.usage(USAGE, null, commandLine, arguments, System.out);
                System.exit(0);
            }
            Usage.usage(USAGE, e, commandLine, arguments, System.err);
            System.exit(-1);
        }
        try {
            System.exit(mergeFastq.call());
        }
        catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
968085
public static void main(String argv[]) {
    if (argv.length == 0) {
      System.out.println("Usage : java CHTBLexer <inputfile>");
    }
    else {
      for (int i = 0; i < argv.length; i++) {
        CHTBLexer scanner = null;
        try {
          scanner = new CHTBLexer( new java.io.FileReader(argv[i]) );
          while ( !scanner.zzAtEOF ) scanner.yylex();
        }
        catch (java.io.FileNotFoundException e) {
          System.out.println("File not found : \""+argv[i]+"\"");
        }
        catch (java.io.IOException e) {
          System.out.println("IO error scanning file \""+argv[i]+"\"");
          System.out.println(e);
        }
        catch (Exception e) {
          System.out.println("Unexpected exception:");
          e.printStackTrace();
        }
      }
    }
  }
412358
private void parse(String[] args) {
    Options cliOpts = setupOptions();
    BasicParser parser = new BasicParser();
    CommandLine cl = null;
    try {
      try {
       cl = parser.parse(cliOpts, args);
      } catch (ParseException ex) {
        throw new IllegalArgumentException("args = " + Arrays.toString(args));
      }

      int newThreshold = Integer.parseInt(cl.getOptionValue("threshold", "10"));
      int iterationTime = Integer.parseInt(cl.getOptionValue("iter_len",
                                 String.valueOf(maxIterationTime/(60 * 1000))));
      maxConcurrentMoves = Integer.parseInt(cl.getOptionValue("node_par_moves",
                                     String.valueOf(MAX_NUM_CONCURRENT_MOVES)));
      moveThreads = Integer.parseInt(cl.getOptionValue("par_moves",
                                     String.valueOf(MOVER_THREAD_POOL_SIZE)));
      maxIterationTime = iterationTime * 60 * 1000L;

      threshold = checkThreshold(newThreshold);
      System.out.println("Running with threshold of " + threshold
          + " and iteration time of " + maxIterationTime + " milliseconds");
    } catch (RuntimeException e) {
      printUsage(cliOpts);
      throw e;
    }
  }
342806
public static void main(String args[]) throws Exception {
		String imageFolder = "C:/images/";
		String imagFilename = "test.jpg";
		String[] codebookFiles = { "C:/codebook1.csv", "C:/codebook2.csv", "C:/codebook3.csv",
				"C:/codebook4.csv" };
		int[] numCentroids = { 64, 64, 64, 64 };

		String pcaFilename = "C:/pca.txt";
		int initialLength = numCentroids.length * numCentroids[0] * AbstractFeatureExtractor.SURFLength;
		int targetLength = 128;

		ImageVectorization imvec = new ImageVectorization(imageFolder, imagFilename, targetLength, 512 * 384);
		ImageVectorization.setFeatureExtractor(new SURFExtractor());
		double[][][] codebooks = AbstractFeatureAggregator.readQuantizers(codebookFiles, numCentroids,
				AbstractFeatureExtractor.SURFLength);
		ImageVectorization.setVladAggregator(new VladAggregatorMultipleVocabularies(codebooks));
		if (targetLength < initialLength) {
			PCA pca = new PCA(targetLength, 1, initialLength, true);
			pca.loadPCAFromFile(pcaFilename);
			ImageVectorization.setPcaProjector(pca);
		}
		imvec.setDebug(true);

		ImageVectorizationResult imvr = imvec.call();
		System.out.println(imvr.getImageName() + ": " + Arrays.toString(imvr.getImageVector()));
	}
1039937
@Override
  public int run(String[] args) throws Exception {

    myConf = getConf();

    // Presume this is all HDFS paths, even when access as file://
    hdfs = FileSystem.get(myConf);

    // Grab input args and allow for -Dxyz style arguments
    String[] otherArgs = new GenericOptionsParser(myConf, args)
        .getRemainingArgs();

    // Grab the arguments we're looking for.
    CommandLine commandLine = parseArgs(otherArgs);

    // Grab the input path argument
    input = commandLine.getOptionValue("i");
    LOG.info("input=" + input);

    // Grab the input path argument
    String output = commandLine.getOptionValue("o");
    LOG.info("output=" + output);

    skipExisting = commandLine.hasOption("s");
    LOG.info("skipExisting=" + skipExisting);

    moveFiles = commandLine.hasOption("m");
    LOG.info("moveFiles=" + moveFiles);

    if (skipExisting && moveFiles) {
      throw new IllegalArgumentException(
          "Cannot use both options skipExisting and move simultaneously.");
    }

    if (commandLine.hasOption("x")) {
      try {
        maXretention = Integer.parseInt(commandLine.getOptionValue("x"));
      } catch (NumberFormatException nfe) {
        throw new IllegalArgumentException(
            "maXretention option -x is is not a valid number: "
                + commandLine.getOptionValue("x"), nfe);
      }
      // Additional check
      if (maXretention < 0) {
        throw new IllegalArgumentException(
            "Cannot retain less than 0 files. Specified maXretention option -x is: "
                + commandLine.getOptionValue("x"));
      }
      LOG.info("maXretention=" + maXretention);
      if (moveFiles) {
        throw new IllegalArgumentException(
            "Cannot use both options maXretention and move simultaneously.");
      }
    } else {
      maXretention = Integer.MAX_VALUE;
    }

    outputPath = new Path(output);
    FileStatus outputFileStatus = hdfs.getFileStatus(outputPath);

    if (!outputFileStatus.isDir()) {
      throw new IOException("Output is not a directory"
          + outputFileStatus.getPath().getName());
    }

    Path inputPath = new Path(input);
    URI inputURI = inputPath.toUri();
    String inputScheme = inputURI.getScheme();

    LOG.info("input scheme is: " + inputScheme);

    // If input directory is HDFS, then process as such. Assume not scheme is
    // HDFS
    if ((inputScheme == null)
        || (hdfs.getUri().getScheme().equals(inputScheme))) {
      processHDFSSources(inputPath);
    } else if (inputScheme.equals("file")) {
      if (moveFiles) {
        throw new IllegalArgumentException(
            "Cannot move files that are not already in hdfs. Input is not HDFS: "
                + input);
      }
      processPlainFileSources(inputURI);
    } else {
      throw new IllegalArgumentException(
          "Cannot process files from this URI scheme: " + inputScheme);
    }

    Statistics statistics = FileSystem.getStatistics(outputPath.toUri()
        .getScheme(), hdfs.getClass());
    if (statistics != null) {
      LOG.info("HDFS bytes read: " + statistics.getBytesRead());
      LOG.info("HDFS bytes written: " + statistics.getBytesWritten());
      LOG.info("HDFS read ops: " + statistics.getReadOps());
      System.out
          .println("HDFS large read ops: " + statistics.getLargeReadOps());
      LOG.info("HDFS write ops: " + statistics.getWriteOps());
    }

    return 0;
  }
727917
public static void main(String[] args) throws Exception {
    StringUtils.printErrInvocationString("CMMClassifier", args);

    Properties props = StringUtils.argsToProperties(args);
    CMMClassifier cmm = new CMMClassifier<CoreLabel>(props);
    String testFile = cmm.flags.testFile;
    String textFile = cmm.flags.textFile;
    String loadPath = cmm.flags.loadClassifier;
    String serializeTo = cmm.flags.serializeTo;

    // cmm.crossValidateTrainAndTest(trainFile);
    if (loadPath != null) {
      cmm.loadClassifierNoExceptions(loadPath, props);
    } else if (cmm.flags.loadJarClassifier != null) {
      cmm.loadJarClassifier(cmm.flags.loadJarClassifier, props);
    } else if (cmm.flags.trainFile != null) {
      if (cmm.flags.biasedTrainFile != null) {
        cmm.trainSemiSup();
      } else {
        cmm.train();
      }
    } else {
      cmm.loadDefaultClassifier();
    }

    if (serializeTo != null) {
      cmm.serializeClassifier(serializeTo);
    }

    if (testFile != null) {
      cmm.classifyAndWriteAnswers(testFile, cmm.makeReaderAndWriter());
    } else if (cmm.flags.testFiles != null) {
      cmm.classifyAndWriteAnswers(cmm.flags.baseTestDir, cmm.flags.testFiles,
                                  cmm.makeReaderAndWriter());
    }

    if (textFile != null) {
      DocumentReaderAndWriter readerAndWriter =
        new PlainTextDocumentReaderAndWriter();
      cmm.classifyAndWriteAnswers(textFile, readerAndWriter);
    }
  }
284575
public static void main(String[] args) throws Exception {
    if (args[0].equals("-readDoc")) {
      Document doc = readDocumentFromFile(args[1]);
      System.out.println(doc);
    } else {
      String s = IOUtils.slurpFile(args[0]);
      Reader r = new StringReader(s);
      String tag = readTag(r);
      while (tag.length() > 0) {
        readUntilTag(r);
        tag = readTag(r);
        if (tag.length() == 0) {
          break;
        }
        System.out.println("got tag=" + new XMLTag(tag));
      }
    }
  }
574419
public static void main( String [] args ) throws IOException
    {
        String filename = args[0];
        String param = args[1];
        String value = args[2];

        try (FileReader fr = new FileReader( filename )) {
            String templateText = SimpleTemplate.getStringFromStream( fr );
            SimpleTemplate template = new SimpleTemplate( templateText );

            template.replace( param, value );
            template.write( System.out );
        }
    }
440882
public static void main(String argv[]) throws Exception {
        String idlFile = null;
        String pkgName = null;
        String outDir = null;
        String nsPkgName = null;
        boolean allImmutable = false;
        List<String> immutableSubstr = new ArrayList<String>();

        for (int i = 0; i < argv.length; i++) {
            if (argv[i].equals("-j")) {
                idlFile = argv[++i];
            }
            else if (argv[i].equals("-p")) {
                pkgName = argv[++i];
            }
            else if (argv[i].equals("-o")) {
                outDir = argv[++i];
            }
            else if (argv[i].equals("-b")) {
                nsPkgName = argv[++i];
            }
            else if (argv[i].equals("-s")) {
                immutableSubstr.add(argv[++i]);
            }
            else if (argv[i].equals("-i")) {
                allImmutable = true;
            }
        }

        if (isBlank(idlFile) || isBlank(pkgName) || isBlank(outDir)) {
            out("Usage: java com.bitmechanic.barrister.Idl2Java -j [idl file] -p [Java package prefix] -b [Java package prefix for namespaced entities] -o [out dir] -i -s [immutable class substr]");
            System.exit(1);
        }

        if (nsPkgName == null) {
            nsPkgName = pkgName;
        }

        new Idl2Java(idlFile, pkgName, nsPkgName, outDir, allImmutable, immutableSubstr);
    }
1097030
public static void main(String[] args) throws IOException {

    String encoding = args[1];
    Reader in = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]), encoding));

    Tokenizer<String> st = new CHTBTokenizer(in);

    while (st.hasNext()) {
      String s = st.next();
      EncodingPrintWriter.out.println(s, encoding);
      // EncodingPrintWriter.out.println("|" + s + "| (" + s.length() + ")",
      //				encoding);
    }
  }
332771
public static void main(String [] args){
        if (args.length != 2){
            displayHelp();
            return;
        }
        
        //Read the input data
        try{
            String option = args[0];
            if (option.equalsIgnoreCase("-inputfile")){
                BufferedReader in = new BufferedReader(
                        new InputStreamReader(new FileInputStream(args[1]), "UTF-8"));
                BufferedWriter out = new BufferedWriter(
                        new OutputStreamWriter(new FileOutputStream(args[1] + ".tkn") , "UTF-8"));

                String line = "";
                while ((line = in.readLine()) != null){                
                    out.write(PennTokenizer.tokenize(line));
                    out.write("\n");
                }
                
                in.close();
                out.close();
            }
            
            else if (option.equalsIgnoreCase("-inputdir")){
                System.out.println("Tokenize input");
                //segment only files ends with .sent
                File inputDir = new File(args[1]);
                File [] childrent = inputDir.listFiles(new FilenameFilter() {
                    public boolean accept(File dir, String name) {
                        return name.endsWith(".sent");
                    }
                });
                
                for (int i = 0; i < childrent.length; ++i){                    
                    BufferedReader in = new BufferedReader(
                            new InputStreamReader(new FileInputStream(childrent[i]), "UTF-8"));
                    BufferedWriter out = new BufferedWriter(
                            new OutputStreamWriter(new FileOutputStream(childrent[i] + ".tkn") , "UTF-8"));

                    String line = "";
                    while ((line = in.readLine()) != null){                
                        out.write(PennTokenizer.tokenize(line));
                        out.write("\n");
                    }

                    in.close();
                    out.close();    
                }
            }           
        } catch (Exception e){
            System.out.println("Error:" + e.getMessage());
        }
    }