Class FileResource
java.lang.Object
org.apache.hc.client5.http.cache.Resource
org.apache.hc.client5.http.impl.cache.FileResource
- All Implemented Interfaces:
Serializable
Cache resource backed by a file.
- Since:
- 4.1
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicReference<File> private final longprivate static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Indicates the system no longer needs to keep this response body and any system resources associated with it may be reclaimed.byte[]get()Returns resource content as a byte array.(package private) FilegetFile()Returns resource content as anInputStream.longlength()Returns the length in bytes of the response body.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
fileRef
-
len
private final long len
-
-
Constructor Details
-
FileResource
-
-
Method Details
-
getFile
File getFile() -
get
Description copied from class:ResourceReturns resource content as a byte array.Please note for memory efficiency some resource implementations may return a reference to the underlying byte array. The returned value should be treated as immutable.
- Specified by:
getin classResource- Throws:
ResourceIOException
-
getInputStream
Description copied from class:ResourceReturns resource content as anInputStream.- Overrides:
getInputStreamin classResource- Throws:
ResourceIOException
-
length
public long length()Description copied from class:ResourceReturns the length in bytes of the response body. -
dispose
public void dispose()Description copied from class:ResourceIndicates the system no longer needs to keep this response body and any system resources associated with it may be reclaimed.
-