private static <T> HttpData toHttpData(Function<? super T, String> contentConverter, @Nullable T value) {
        final String content = contentConverter.apply(value);
        requireNonNull(content, "contentConverter.apply() returned null");
        final byte[] contentBytes = content.getBytes(StandardCharsets.UTF_8);
        final int contentLength = contentBytes.length;
        final byte[] jsonText = new byte[contentLength + 2];
        jsonText[0] = RECORD_SEPARATOR;
        System.arraycopy(contentBytes, 0, jsonText, 1, contentLength);
        jsonText[contentLength + 1] = LINE_FEED;
        return HttpData.wrap(jsonText);
    }
Creates a new JSON Text Sequences of the specified {@code content}.

<p>Note that this method is intentionally hidden from the public API for use only with
{@code ScalaPbResponseConverterFunction} and {@code ProtobufResponseConverterFunction}.
Because the {@code contentConverter} can easily produce a malformed string which violates the
<a href="https://datatracker.ietf.org/doc/rfc8259/">JSON format</a>.

@param headers the HTTP headers supposed to send
@param content the object supposed to send as contents
@param trailers the HTTP trailers
@param contentConverter the function which converts the content object into a UTF-8 JSON string.
core/src/main/java/com/linecorp/armeria/server/streaming/JsonTextSequences.java