java.lang.Object
org.miaixz.bus.http.cache.DiskLruCache.Editor
- Enclosing class:
DiskLruCache
Edits the values for an entry.
-
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Aborts this edit.voidAborts this edit unless it has been committed.voidcommit()Commits this edit so it is visible to readers.org.miaixz.bus.core.io.sink.SinknewSink(int index) Returns a new unbuffered output stream to write the value atindex.org.miaixz.bus.core.io.source.SourcenewSource(int index) Returns an unbuffered input stream to read the last committed value, or null if no value has been committed.
-
Method Details
-
newSource
public org.miaixz.bus.core.io.source.Source newSource(int index) Returns an unbuffered input stream to read the last committed value, or null if no value has been committed.- Parameters:
index- the index of the value.- Returns:
- a source for the value, or null.
-
newSink
public org.miaixz.bus.core.io.sink.Sink newSink(int index) Returns a new unbuffered output stream to write the value atindex. If the underlying output stream encounters errors when writing to the filesystem, this edit will be aborted whencommit()is called. The returned output stream does not throw IOExceptions.- Parameters:
index- the index of the value.- Returns:
- a sink for the value.
-
commit
Commits this edit so it is visible to readers. This releases the edit lock so another edit may be started on the same key.- Throws:
IOException- if an I/O error occurs.
-
abort
Aborts this edit. This releases the edit lock so another edit may be started on the same key.- Throws:
IOException- if an I/O error occurs.
-
abortUnlessCommitted
public void abortUnlessCommitted()Aborts this edit unless it has been committed.
-