MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / saveLog

Method saveLog

src/org/opensourcephysics/controls/OSPLog.java:601–614  ·  view source on GitHub ↗

Saves the log to a text file specified by name. @param fileName the file name @return the name of the file

(String fileName)

Source from the content-addressed store, hash-verified

599 * @return the name of the file
600 */
601 public String saveLog(String fileName) {
602 if((fileName==null)||fileName.trim().equals("")) { //$NON-NLS-1$
603 return saveLogAs();
604 }
605 try {
606 BufferedWriter out = new BufferedWriter(new FileWriter(fileName));
607 out.write(getText());
608 out.flush();
609 out.close();
610 return fileName;
611 } catch(IOException ex) {
612 return null;
613 }
614 }
615
616 /**
617 * Allows getting the text from the logBuffer

Callers 1

saveLogAsMethod · 0.95

Calls 7

saveLogAsMethod · 0.95
getTextMethod · 0.95
equalsMethod · 0.65
writeMethod · 0.65
closeMethod · 0.65
trimMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected