private byte[] readFully(final InputStream in) throws IOException {
            final ByteArrayOutputStream out = new ByteArrayOutputStream();
            final byte[] buffer = new byte[1024];
            int len;

            while ((len = in.read(buffer)) != -1) {
                out.write(buffer, 0, len);
            }

            return out.toByteArray();
        }
Verifies the content of the remote producer snapshot matches with the {@code expected} array.

@param id The unique ID of the remote log segment and associated resources (e.g. offset and time indexes).
@param expected The expected content.
storage/src/test/java/org/apache/kafka/server/log/remote/storage/LocalTieredStorageTest.java