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

Method copyTo

corpus/java/training/guava/io/ByteSource.java:240–253  ·  view source on GitHub ↗

Copies the contents of this byte source to the given OutputStream. Does not close output. @return the number of bytes copied @throws IOException if an I/O error occurs in the process of reading from this source or writing to output

(OutputStream output)

Source from the content-addressed store, hash-verified

238 * writing to {@code output}
239 */
240 @CanIgnoreReturnValue
241 public long copyTo(OutputStream output) throws IOException {
242 checkNotNull(output);
243
244 Closer closer = Closer.create();
245 try {
246 InputStream in = closer.register(openStream());
247 return ByteStreams.copy(in, output);
248 } catch (Throwable e) {
249 throw closer.rethrow(e);
250 } finally {
251 closer.close();
252 }
253 }
254
255 /**
256 * Copies the contents of this byte source to the given {@code ByteSink}.

Callers 3

hashMethod · 0.95
copyMethod · 0.45
copyMethod · 0.45

Calls 7

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

Tested by

no test coverage detected