Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.09 KB | None | 0 0
  1. 7f00000000000000000000000000000000000000000000000000000000000000027f00000000000000000000000000000000000000000000000000000000000000027f00000000000000000000000000000000000000000000000000000000000000020101
  2. 7f00000000000000000000000000000000000000000000000000000000000000037f00000000000000000000000000000000000000000000000000000000000000037f00000000000000000000000000000000000000000000000000000000000000030101
  3. 7f00000000000000000000000000000000000000000000000000000000000000047f00000000000000000000000000000000000000000000000000000000000000047f00000000000000000000000000000000000000000000000000000000000000040101
  4. 7f00000000000000000000000000000000000000000000000000000000000000057f00000000000000000000000000000000000000000000000000000000000000057f00000000000000000000000000000000000000000000000000000000000000050101
  5. 7f00000000000000000000000000000000000000000000000000000000000000067f00000000000000000000000000000000000000000000000000000000000000067f00000000000000000000000000000000000000000000000000000000000000060101
  6.  
  7. import java.io.*;
  8. import java.util.Scanner;
  9. import java.util.List;
  10. import java.util.ArrayList;
  11.  
  12. class showMe {
  13.  
  14. public static void main(String[] args) {
  15. // populate from file
  16. List<String> inputLinesObject = new ArrayList<String>();
  17. inputLinesObject = readFile("/Users/s.matthew.english/ConsenSys/PegaSys/sprint/txs/codes.txt", inputLinesObject);
  18.  
  19. // print output
  20. for(String str : inputLinesObject){
  21. //System.out.println(str);
  22.  
  23. // now run the command on the terminal and get the result
  24. try {
  25.  
  26. Runtime rt = Runtime.getRuntime();
  27. String command = "evm --debug --code " + str + " run";
  28. Process proc = rt.exec(command);
  29.  
  30. BufferedReader stdInput = new BufferedReader(new
  31. InputStreamReader(proc.getInputStream()));
  32.  
  33. BufferedReader stdError = new BufferedReader(new
  34. InputStreamReader(proc.getErrorStream()));
  35.  
  36. // read the output from the command
  37. System.out.println("Here is the standard output of the command:n");
  38. String s = null;
  39. while ((s = stdInput.readLine()) != null) {
  40. System.out.println(s);
  41. }
  42.  
  43. // read any errors from the attempted command
  44. System.out.println("Here is the standard error of the command (if any):n");
  45. while ((s = stdError.readLine()) != null) {
  46. System.out.println(s);
  47. }
  48.  
  49. } catch (IOException e) {
  50. System.out.println(e);
  51. }
  52.  
  53. }
  54.  
  55.  
  56. }
  57.  
  58. private static List<String> readFile(String fileName, List<String> inputLines) {
  59. try {
  60. File file = new File(fileName);
  61. Scanner scanner = new Scanner(file);
  62. while (scanner.hasNextLine()) {
  63. inputLines.add(scanner.nextLine());
  64. }
  65. scanner.close();
  66. } catch (FileNotFoundException e) {
  67. e.printStackTrace();
  68. }
  69. return inputLines;
  70. }
  71.  
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement