Load this piece of code from a file and return the contents. This completely ignores any changes in the linked storage, if any, and just directly reads the file.
()
| 253 | * just directly reads the file. |
| 254 | */ |
| 255 | public String load() throws IOException { |
| 256 | String text = BaseNoGui.loadFile(file); |
| 257 | |
| 258 | if (text == null) { |
| 259 | throw new IOException(); |
| 260 | } |
| 261 | |
| 262 | if (text.indexOf('\uFFFD') != -1) { |
| 263 | System.err.println( |
| 264 | I18n.format( |
| 265 | tr("\"{0}\" contains unrecognized characters. " + |
| 266 | "If this code was created with an older version of Arduino, " + |
| 267 | "you may need to use Tools -> Fix Encoding & Reload to update " + |
| 268 | "the sketch to use UTF-8 encoding. If not, you may need to " + |
| 269 | "delete the bad characters to get rid of this warning."), |
| 270 | file.getName() |
| 271 | ) |
| 272 | ); |
| 273 | System.err.println(); |
| 274 | } |
| 275 | return text; |
| 276 | } |
| 277 | |
| 278 | |
| 279 | /** |