@Override
    public void onNext(HttpData httpData) {
        if (httpData.isEmpty()) {
            httpData.close();
            assert subscription != null;
            subscription.request(1);
        } else {
            final ByteBuf byteBuf = httpData.byteBuf();
            final ByteBuffer byteBuffer = byteBuf.nioBuffer();
            writing = true;
            try {
                assert fileChannel != null;
                fileChannel.write(byteBuffer, position, Maps.immutableEntry(byteBuffer, byteBuf), this);
            } catch (Throwable ex) {
                maybeCloseFileChannel(ex, false);
            }
        }
    }
Asynchronously writes a {@code StreamMessage<HttpMessage>} to a {@link File}.
core/src/main/java/com/linecorp/armeria/common/stream/AsyncFileWriter.java