@Nullable
    @Override
    protected final HttpResponse doRead(ResponseHeaders headers, long length,
                                        Executor fileReadExecutor, ByteBufAllocator alloc) throws IOException {
        final T in = newStream();
        if (in == null) {
            return null;
        }

        boolean submitted = false;
        try {
            final HttpResponseWriter res = HttpResponse.streaming();
            res.write(headers);
            fileReadExecutor.execute(() -> doRead(res, in, 0, length, fileReadExecutor, alloc));
            submitted = true;
            return res;
        } finally {
            if (!submitted) {
                close(in);
            }
        }
    }
Creates a new instance.

@param contentType the {@link MediaType} of the file which will be used as the {@code "content-type"}
                   header value. {@code null} to disable setting the {@code "content-type"} header.
@param clock the {@link Clock} which provides the current date and time
@param dateEnabled whether to set the {@code "date"} header automatically
@param lastModifiedEnabled whether to add the {@code "last-modified"} header automatically
@param entityTagFunction the {@link BiFunction} that generates an entity tag from the file's attributes.
                         {@code null} to disable setting the {@code "etag"} header.
@param headers the additional headers to set
core/src/main/java/com/linecorp/armeria/server/file/StreamingHttpFile.java