Appends the contents of this source to the given Appendable (such as a Writer). Does not close appendable if it is Closeable. @return the number of characters copied @throws IOException if an I/O error occurs in the process of reading from this source or writing
(Appendable appendable)
| 186 | * writing to {@code appendable} |
| 187 | */ |
| 188 | @CanIgnoreReturnValue |
| 189 | public long copyTo(Appendable appendable) throws IOException { |
| 190 | checkNotNull(appendable); |
| 191 | |
| 192 | Closer closer = Closer.create(); |
| 193 | try { |
| 194 | Reader reader = closer.register(openStream()); |
| 195 | return CharStreams.copy(reader, appendable); |
| 196 | } catch (Throwable e) { |
| 197 | throw closer.rethrow(e); |
| 198 | } finally { |
| 199 | closer.close(); |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * Copies the contents of this source to the given sink. |
nothing calls this directly
no test coverage detected