code: public long copyTo(ByteSink sink) throws IOException {
      checkNotNull(sink);
  
      Closer closer = Closer.create();
      try {
        InputStream in = closer.register(openStream());
        OutputStream out = closer.register(sink.openStream());
        return ByteStreams.copy(in, out);
      } catch (Throwable e) {
        throw closer.rethrow(e);
      } finally {
        closer.close();
      }
    }
docs: Copies the contents of this byte source to the given {@code ByteSink}.
  
  @throws IOException if an I/O error occurs in the process of reading from this source or
  writing to {@code sink}