GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Java-to-Python-Transcoder/Transcoder.java at main · levertyk/Java-to-Python-Transcoder Expand file tree/ Copy pathTranscoder.javaMore file actions 69 lines (57 loc) · 1.79 KB / Copy pathTranscoder.javaFile metadata and controls69 lines (57 loc) · 1.79 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 import java.util.Scanner; import Tokens.ClassToken; import java.io.*; /** * @author Keenan Leverty * @author Peter Matern * @author Chris Allender * */ public class Transcoder { ClassToken startingToken; /** * Creates a new Transcoder starting with the class token * @param input string containing input */ Transcoder(String input) { startingToken = new ClassToken(input); } @Override public String toString() { return startingToken.toString(); } /** * Run the program. Prompt the user for the file path of the java file to be trascoded. * * @param args */ public static void main(String[] args) { String inputPath = ""; String input = ""; Scanner in = new Scanner(System.in); System.out.println("Enter the file path to be trascoded:\n"); inputPath = in.nextLine(); in.close(); try { File file = new File(inputPath); Scanner sc = new Scanner(file); while (sc.hasNextLine()) { input += sc.nextLine(); } sc.close(); } catch (FileNotFoundException e) { System.out.println("ERROR: " + e.getMessage()); // Could not find the file } // new Transcoder Transcoder tr = new Transcoder(input); try { String outputPath = inputPath.replaceAll(".java", ".py"); BufferedWriter writer = new BufferedWriter(new FileWriter(outputPath)); writer.write(tr.toString()); writer.close(); System.out.println("\nThe file was successfully transcoded"); } catch (IOException e) { System.out.println("ERROR: " + e.getMessage()); // Could not create output file } } } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |