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}
(ByteSource other)
| 347 | * @throws IOException if an I/O error occurs while reading from this source or {@code other} |
| 348 | */ |
| 349 | public boolean contentEquals(ByteSource other) throws IOException { |
| 350 | checkNotNull(other); |
| 351 | |
| 352 | Closer closer = Closer.create(); |
| 353 | try { |
| 354 | return ByteStreams.contentsEqual( |
| 355 | closer.register(openStream()), closer.register(other.openStream())); |
| 356 | } catch (Throwable e) { |
| 357 | throw closer.rethrow(e); |
| 358 | } finally { |
| 359 | closer.close(); |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | /** |
| 364 | * Concatenates multiple {@link ByteSource} instances into a single source. Streams returned from |