Package com.squareup.okhttp.internal
Class DiskLruCache.Editor
java.lang.Object
com.squareup.okhttp.internal.DiskLruCache.Editor
- Enclosing class:
- DiskLruCache
public final class DiskLruCache.Editor extends Object
Edits the values for an entry.
-
Method Summary
Modifier and Type Method Description voidabort()Aborts this edit.voidabortUnlessCommitted()voidcommit()Commits this edit so it is visible to readers.StringgetString(int index)Returns the last committed value as a string, or null if no value has been committed.InputStreamnewInputStream(int index)Returns an unbuffered input stream to read the last committed value, or null if no value has been committed.OutputStreamnewOutputStream(int index)Returns a new unbuffered output stream to write the value atindex.voidset(int index, String value)Sets the value atindextovalue.
-
Method Details
-
newInputStream
Returns an unbuffered input stream to read the last committed value, or null if no value has been committed.- Throws:
IOException
-
getString
Returns the last committed value as a string, or null if no value has been committed.- Throws:
IOException
-
newOutputStream
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.- Throws:
IOException
-
set
Sets the value atindextovalue.- Throws:
IOException
-
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
-
abort
Aborts this edit. This releases the edit lock so another edit may be started on the same key.- Throws:
IOException
-
abortUnlessCommitted
public void abortUnlessCommitted()
-