Read a single character from the file. Implements a JavaScript function that reads the next character from the file. @return the next character from the file as a single-character string, or null if end of file is reached @throws IOException if an error occurred while accessing the file ass
()
| 167 | * object, or if the file cannot be read |
| 168 | */ |
| 169 | @JSFunction |
| 170 | public String readChar() throws IOException { |
| 171 | int i = getReader().read(); |
| 172 | if (i == -1) return null; |
| 173 | char[] charArray = {(char) i}; |
| 174 | return new String(charArray); |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * Write strings to the file. |
no test coverage detected