static StreamMessage<Integer> newStream(StreamObjects streamObjects) {
        switch (streamObjects.streamType) {
            case DEFAULT_STREAM_MESSAGE:
                return StreamMessage.streaming();
            case FIXED_STREAM_MESSAGE:
                switch (streamObjects.num) {
                    case 0:
                        return StreamMessage.of();
                    case 1:
                        return StreamMessage.of(streamObjects.values[0]);
                    case 2:
                        return StreamMessage.of(streamObjects.values[0], streamObjects.values[1]);
                    default:
                        return StreamMessage.of(streamObjects.values);
                }
            case DEFERRED_FIXED_STREAM_MESSAGE:
                final DeferredStreamMessage<Integer> stream = new DeferredStreamMessage<>();
                stream.delegate(StreamMessage.of(streamObjects.values));
                return stream;
            default:
                throw new Error();
        }
    }
Microbenchmarks of {@link StreamMessage Stream Messages}.
benchmarks/jmh/src/jmh/java/com/linecorp/armeria/common/stream/StreamMessageBenchmark.java