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

Method read

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

Reads a file. @param fileName the name of the file @return the file contents as a String

(String fileName)

Source from the content-addressed store, hash-verified

1058 * @return the file contents as a String
1059 */
1060 protected String read(String fileName) {
1061 File file = new File(fileName);
1062 StringBuffer buffer = null;
1063 try {
1064 BufferedReader in = new BufferedReader(new FileReader(file));
1065 buffer = new StringBuffer();
1066 String line = in.readLine();
1067 while(line!=null) {
1068 buffer.append(line+XML.NEW_LINE);
1069 line = in.readLine();
1070 }
1071 in.close();
1072 return buffer.toString();
1073 } catch(IOException ex) {
1074 logger.warning(ex.toString());
1075 return "";
1076 }
1077 }
1078
1079 /**
1080 * Singleton logging frame.

Callers 2

saveXMLMethod · 0.95
openMethod · 0.95

Calls 4

appendMethod · 0.65
closeMethod · 0.65
toStringMethod · 0.45
warningMethod · 0.45

Tested by

no test coverage detected