fork download
  1.  
  2.  
  3. public class main {
  4. public static void main(String[] args) {
  5. if (promptStringOrFile()) {
  6. /*
  7. //These functions are actually called, but all I want to figure out is promptStringOrFile() for now...
  8. String config[] = grabConfig();
  9. String input=readInput();
  10. Counter counter=new Counter(config);
  11. WordFrequency frequency=counter.process(input);
  12. frequency.output();
  13. */
  14. }
  15. }
  16.  
  17. public static boolean promptStringOrFile() {
  18. char cbuf[] = new char[2];
  19. do {
  20. System.out.println("Do you want to process standard (I)nput, or a (F)ile? I/F");
  21. try {
  22. br.read(cbuf, 0, 1);
  23. } catch (IOException e) {
  24. inputReadFailure(e);
  25. }
  26. } while ((!(cbuf[0]=='I' || cbuf[0]=='F')));
  27. if (cbuf[0]=='I') {
  28. return true;
  29. }
  30. else
  31. return false;
  32. }
  33.  
  34. public static String readInput() {
  35. String toReturn = null;
  36. try {
  37. toReturn = br.readLine();
  38. } catch (IOException e) {
  39. System.err.println("ERROR: Failed to read User input!");
  40. e.printStackTrace();
  41. System.exit(-1);
  42. } finally {
  43. return toReturn;
  44. }
  45. }
  46. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout

Standard output is empty