Package rife.engine
Class SiteCookieFileStore
java.lang.Object
rife.engine.SiteCookieFileStore
- All Implemented Interfaces:
SiteCookieStore
Stores the cookies of a
SiteCookieJar in a file.
The file is replaced as a whole each time the cookies change, so that
it's never left half written when your application is stopped. Only
java.io is used for this, since on iOS parts of
java.nio.file bring along a disk space call that Apple wants a
reason for in the privacy manifest of your app.
The cookies can be credentials, so the file should be in a location that your application protects, its own application support directory for instance.
- Since:
- 1.11.0
-
Constructor Summary
ConstructorsConstructorDescriptionSiteCookieFileStore(File file) Creates a store that keeps the cookies in a file. -
Method Summary
Modifier and TypeMethodDescriptiongetFile()Retrieves the file of the cookies.load()Provides the cookies that were stored before.voidsave(Collection<SiteCookie> cookies) Stores all the cookies that should last.
-
Constructor Details
-
SiteCookieFileStore
Creates a store that keeps the cookies in a file.- Parameters:
file- the file of the cookies, which doesn't have to exist yet- Since:
- 1.11.0
-
-
Method Details
-
getFile
Retrieves the file of the cookies.- Returns:
- the file of this store
- Since:
- 1.11.0
-
load
Description copied from interface:SiteCookieStoreProvides the cookies that were stored before. The jar will drop the ones that have expired.- Specified by:
loadin interfaceSiteCookieStore- Returns:
- the stored cookies; or
nullif there are none
-
save
Description copied from interface:SiteCookieStoreStores all the cookies that should last. This method will be called each time they change.- Specified by:
savein interfaceSiteCookieStore- Parameters:
cookies- the cookies to store, which replace what was stored before
-