Reads the contents of this source as a string. @throws IOException if an I/O error occurs in the process of reading from this source
()
| 237 | |
| 238 | |
| 239 | public String read() throws IOException { |
| 240 | Closer closer = Closer.create(); |
| 241 | try { |
| 242 | Reader reader = closer.register(openStream()); |
| 243 | return CharStreams.toString(reader); |
| 244 | } catch (Throwable e) { |
| 245 | throw closer.rethrow(e); |
| 246 | } finally { |
| 247 | closer.close(); |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Reads the first link of this source as a string. Returns {@code null} if this source is empty. |