@Override
    public byte[] get() throws ResourceIOException {
        final File file = this.fileRef.get();
        if (file == null) {
            throw new ResourceIOException("Resource already disposed");
        }
        try (final InputStream in = new FileInputStream(file)) {
            final ByteArrayBuffer buf = new ByteArrayBuffer(1024);
            final byte[] tmp = new byte[2048];
            int len;
            while ((len = in.read(tmp)) != -1) {
                buf.append(tmp, 0, len);
            }
            return buf.toByteArray();
        } catch (final IOException ex) {
            throw new ResourceIOException(ex.getMessage(), ex);
        }
    }
Cache resource backed by a file.

@since 4.1
httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/FileResource.java