MCPcopy Create free account
hub / github.com/antlr/codebuff / writeFrom

Method writeFrom

corpus/java/training/guava/io/CharSink.java:150–165  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

148 * writing to this sink
149 */
150 @CanIgnoreReturnValue
151 public long writeFrom(Readable readable) throws IOException {
152 checkNotNull(readable);
153
154 Closer closer = Closer.create();
155 try {
156 Writer out = closer.register(openStream());
157 long written = CharStreams.copy(readable, out);
158 out.flush(); // https://code.google.com/p/guava-libraries/issues/detail?id=1330
159 return written;
160 } catch (Throwable e) {
161 throw closer.rethrow(e);
162 } finally {
163 closer.close();
164 }
165 }
166}

Callers

nothing calls this directly

Calls 8

createMethod · 0.95
registerMethod · 0.95
openStreamMethod · 0.95
copyMethod · 0.95
rethrowMethod · 0.95
closeMethod · 0.95
checkNotNullMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected