code: public boolean contentEquals(ByteSource other) throws IOException {
      checkNotNull(other);
  
      byte[] buf1 = createBuffer();
      byte[] buf2 = createBuffer();
  
      Closer closer = Closer.create();
      try {
        InputStream in1 = closer.register(openStream());
        InputStream in2 = closer.register(other.openStream());
        while (true) {
          int read1 = ByteStreams.read(in1, buf1, 0, buf1.length);
          int read2 = ByteStreams.read(in2, buf2, 0, buf2.length);
          if (read1 != read2 || !Arrays.equals(buf1, buf2)) {
            return false;
          } else if (read1 != buf1.length) {
            return true;
          }
        }
      } catch (Throwable e) {
        throw closer.rethrow(e);
      } finally {
        closer.close();
      }
    }
docs: Checks that the contents of this byte source are equal to the contents of the given byte
  source.
  
  @throws IOException if an I/O error occurs while reading from this source or {@code other}