Package java.util

Examples of java.util.Scanner.nextLine()


        Scanner scanner = null;
        try {
           
            scanner = new Scanner(file, "UTF-8");
            while (scanner.hasNextLine()) {
                String line = scanner.nextLine();

                String[] values = line.split("=");
                if (values != null && values.length >= 2) {
                    String value = values[1];
                    if (values.length > 2) {
View Full Code Here


      do
      {
        System.out.print("Please select a sample: ");
        try
        {
          String choice = in.nextLine();
          if(choice.toUpperCase().equals(QuitChoiceSymbol)) // Quit.
            return;

          sampleClass = sampleClasses.get(Integer.parseInt(choice));
        }
View Full Code Here

    )
  {
    System.out.print("\n" + message);
    Scanner in = new Scanner(System.in);
    try
    {return in.nextLine();}
    catch(Exception e)
    {return null;}
  }

  /**
 
View Full Code Here

          );
    }
    System.out.print("Please select: ");
    Scanner in = new Scanner(System.in);
    try
    {return in.nextLine();}
    catch(Exception e)
    {return null;}
  }

  protected String promptFileChoice(
View Full Code Here

    resources.printList((String[])filePaths.toArray());

    // Get the user's choice!
    System.out.print(inputDescription + ": ");
    try
    {return inputPath + java.io.File.separator + "pdf" + java.io.File.separator + filePaths.get(Integer.parseInt(in.nextLine()));}
    catch(Exception e)
    {return inputPath + java.io.File.separator + "pdf" + java.io.File.separator + filePaths.get(0);}
  }

  /**
 
View Full Code Here

      System.out.println("[0] Standard serialization");
      System.out.println("[1] Incremental update");
      // Get the user's choice.
      System.out.print("Please select a serialization mode: ");
      try
      {serializationMode = SerializationModeEnum.values()[Integer.parseInt(in.nextLine())];}
      catch(Exception e)
      {/* Default. */}
    }

    java.io.File outputFile = new java.io.File(outputPath + java.io.File.separator + fileName + "." + serializationMode + ".pdf");
View Full Code Here

    System.out.println("\n" + message);
    System.out.println("Press ENTER to continue");
    try
    {
      Scanner in = new Scanner(System.in);
      in.nextLine();
    }
    catch(Exception e)
    {}
  }
}
View Full Code Here

  SMat svdLoadSparseTextHBFile(File file) throws FileNotFoundException {
    int i, x, rows, cols, vals, num_mat;
    Scanner scanner = new Scanner(file);
    SMat S;
    /* Skip the header line: */
    scanner.nextLine();
    /* Skip the line giving the number of lines in this file: */
    scanner.nextLine();
    /* Read the line with useful dimensions: */
    scanner.next();
    rows = scanner.nextInt();
View Full Code Here

    Scanner scanner = new Scanner(file);
    SMat S;
    /* Skip the header line: */
    scanner.nextLine();
    /* Skip the line giving the number of lines in this file: */
    scanner.nextLine();
    /* Read the line with useful dimensions: */
    scanner.next();
    rows = scanner.nextInt();
    cols = scanner.nextInt();
    vals = scanner.nextInt();
View Full Code Here

    scanner.next();
    rows = scanner.nextInt();
    cols = scanner.nextInt();
    vals = scanner.nextInt();
    num_mat = scanner.nextInt();
    scanner.nextLine();
    if (num_mat != 0) {
      throw new Error("svdLoadSparseTextHBFile: I don't know how to handle a file "
          + "with elemental matrices (last entry on header line 3)");
    }
    /* Skip the line giving the formats: */
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.