Writes all the text from the given Readable (such as a Reader) to this sink. Does not close readable if it is Closeable. @return the number of characters written @throws IOException if an I/O error occurs in the process of reading from readable or writing
(Readable readable)
| 157 | */ |
| 158 | |
| 159 | @CanIgnoreReturnValue |
| 160 | public long writeFrom(Readable readable) throws IOException { |
| 161 | checkNotNull(readable); |
| 162 | Closer closer = Closer.create(); |
| 163 | try { |
| 164 | Writer out = closer.register(openStream()); |
| 165 | long written = CharStreams.copy(readable, out); |
| 166 | out.flush(); // https://code.google.com/p/guava-libraries/issues/detail?id=1330 |
| 167 | return written; |
| 168 | } catch (Throwable e) { |
| 169 | throw closer.rethrow(e); |
| 170 | } finally { |
| 171 | closer.close(); |
| 172 | } |
| 173 | } |
| 174 | } |
nothing calls this directly
no test coverage detected