class DataChunkInputStream extends InputStream {

    @Override
    public void close() {
        // Assert: if current != next, next cannot ever be resolved with a chunk that needs releasing
        Optional.ofNullable(current).ifPresent(it -> current.whenComplete(DataChunkInputStream::releaseChunk));
        current = null;
        bufferIndex = 0;
    }

    public  DataChunkInputStream(Flow.Publisher<DataChunk> originalPublisher);
    public  DataChunkInputStream(Flow.Publisher<DataChunk> originalPublisher, boolean validate);

}