default CompletableFuture<byte[]> collectBytes(EventExecutor executor) {
        return collect(executor).thenApply(data -> {
            int totalSize = 0;
            for (HttpData httpData : data) {
                totalSize += httpData.length();
            }
            final byte[] bytes = new byte[totalSize];
            int position = 0;
            for (HttpData httpData : data) {
                final int length = httpData.length();
                System.arraycopy(httpData.array(), 0, bytes, position, length);
                position += length;
            }
            return bytes;
        });
    }
Collects the bytes published by this {@link ByteStreamMessage}.
The returned {@link CompletableFuture} will be notified when the elements are fully consumed.

<pre>{@code
StreamMessage<HttpData> source = StreamMessage.of(HttpData.wrap(new byte[] { 1, 2, 3 }),
                                                  HttpData.wrap(new byte[] { 4, 5, 6 }));

byte[] collected = ByteStreamMessage.of(source).collectBytes(executor).join();
assert Arrays.equals(collected, new byte[] { 1, 2, 3, 4, 5, 6 });
}</pre>

@param executor the executor to collect the {@link HttpData}.
core/src/main/java/com/linecorp/armeria/common/stream/ByteStreamMessage.java