MCPcopy
hub / github.com/arduino/Arduino / createWriter

Method createWriter

arduino-core/src/processing/app/legacy/PApplet.java:536–548  ·  view source on GitHub ↗

I want to print lines to a file. I have RSI from typing these eight lines of code so many times. @throws IOException

(File file)

Source from the content-addressed store, hash-verified

534 * @throws IOException
535 */
536 static public PrintWriter createWriter(File file) throws IOException {
537 createPath(file); // make sure in-between folders exist
538 OutputStream output = new FileOutputStream(file);
539 try {
540 if (file.getName().toLowerCase().endsWith(".gz")) {
541 output = new GZIPOutputStream(output);
542 }
543 } catch (IOException e) {
544 output.close();
545 throw e;
546 }
547 return createWriter(output);
548 }
549
550
551 /**

Callers 2

saveMethod · 0.95
saveStringsMethod · 0.95

Calls 3

createPathMethod · 0.95
getNameMethod · 0.65
closeMethod · 0.45

Tested by

no test coverage detected