MCPcopy
hub / github.com/google/guava / copyTo

Method copyTo

guava/src/com/google/common/io/ByteSource.java:249–262  ·  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 while reading from this source or writing to output

(OutputStream output)

Source from the content-addressed store, hash-verified

247 * output}
248 */
249 @CanIgnoreReturnValue
250 public long copyTo(OutputStream output) throws IOException {
251 checkNotNull(output);
252
253 Closer closer = Closer.create();
254 try {
255 InputStream in = closer.register(openStream());
256 return ByteStreams.copy(in, output);
257 } catch (Throwable e) {
258 throw closer.rethrow(e);
259 } finally {
260 closer.close();
261 }
262 }
263
264 /**
265 * Copies the contents of this byte source to the given {@code ByteSink}.

Calls 7

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