Reads a single character from the source string and returns it as an integer with the two higher-order bytes set to 0. Returns -1 if the end of the source string has been reached. @return the character read or -1 if the end of the source string has been reached. @throws IOException
()
| 115 | * if this reader is closed. |
| 116 | */ |
| 117 | @Override |
| 118 | public int read() throws IOException { |
| 119 | synchronized (lock) { |
| 120 | if (isClosed()) { |
| 121 | throw new IOException("String reader already closed"); //$NON-NLS-1$ |
| 122 | } |
| 123 | if (pos != count) { |
| 124 | return str.charAt(pos++); |
| 125 | } |
| 126 | return -1; |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Reads at most {@code len} characters from the source string and stores |