MCPcopy Index your code
hub / github.com/processing/processing / execute

Method execute

core/methods/src/PAppletMethods.java:39–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37
38
39 public void execute() throws BuildException {
40 // Do a bunch of checks...
41 if (baseDir == null) {
42 throw new BuildException("dir parameter must be set!");
43 }
44
45 //System.out.println("using basedir " + baseDir);
46 File graphicsFile = new File(baseDir, "PGraphics.java");
47 File appletFile = new File(baseDir, "PApplet.java");
48 File imageFile = new File(baseDir, "PImage.java");
49
50 if (!graphicsFile.exists() || !graphicsFile.canRead()) {
51 throw new BuildException("PGraphics file not readable: " +
52 graphicsFile.getAbsolutePath());
53 }
54
55 if (!appletFile.exists() ||
56 !appletFile.canRead() ||
57 !appletFile.canWrite()) {
58 throw new BuildException("PApplet file not read/writeable: " +
59 appletFile.getAbsolutePath());
60 }
61
62 if (!imageFile.exists() || !imageFile.canRead()) {
63 throw new BuildException("PImage file not readable: " +
64 imageFile.getAbsolutePath());
65 }
66
67 // Looking good, let's do this!
68 //ByteArrayOutputStream outBytes = new ByteArrayOutputStream();
69 //PrintStream out = new PrintStream(outBytes, "UTF-8");
70 StringBuilder out = new StringBuilder();
71 StringBuilder content = new StringBuilder();
72
73 try{
74 BufferedReader applet = createReader(appletFile);
75 String line;
76 while ((line = applet.readLine()) != null) {
77 out.append(line);
78 out.append('\n'); // to avoid Windows CRs
79 content.append(line);
80 content.append('\n'); // for efficiency
81
82 if (line.indexOf("public functions for processing.core") >= 0) {
83 break;
84 }
85 }
86
87 // read the rest of the file and append it to the
88 while ((line = applet.readLine()) != null) {
89 content.append(line);
90 content.append('\n');
91 }
92
93 applet.close();
94 process(out, graphicsFile);
95 process(out, imageFile);
96

Callers 2

requestImageMethod · 0.45
setColumnTypesMethod · 0.45

Calls 9

createReaderMethod · 0.95
processMethod · 0.95
printMethod · 0.65
appendMethod · 0.45
closeMethod · 0.45
toStringMethod · 0.45
equalsMethod · 0.45
printlnMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected