@Nonnull
    @Override
    public ReadableByteChannel readableChannel() throws IOException {
        val readableChannel = super.readableChannel();
        return new ReadableByteChannel() {

            @Override
            public boolean isOpen() {
                return readableChannel.isOpen();
            }

            @Override
            public void close() throws IOException {
                closeThenDeleteFile(readableChannel);
            }

            @Override
            public int read(final ByteBuffer dst) throws IOException {
                return readableChannel.read(dst);
            }
        };
    }
This is {@link TemporaryFileSystemResource}.

@author Misagh Moayyed
@since 6.0.0
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/io/TemporaryFileSystemResource.java