Package com.squareup.okhttp.internal
Class DiskLruCache.Snapshot
java.lang.Object
com.squareup.okhttp.internal.DiskLruCache.Snapshot
- All Implemented Interfaces:
Closeable,AutoCloseable
- Enclosing class:
- DiskLruCache
public final class DiskLruCache.Snapshot extends Object implements Closeable
A snapshot of the values for an entry.
-
Method Summary
Modifier and Type Method Description voidclose()Closes the object and release any system resources it holds.DiskLruCache.Editoredit()Returns an editor for this snapshot's entry, or null if either the entry has changed since this snapshot was created or if another edit is in progress.InputStreamgetInputStream(int index)Returns the unbuffered stream with the value forindex.longgetLength(int index)Returns the byte length of the value forindex.StringgetString(int index)Returns the string value forindex.
-
Method Details
-
edit
Returns an editor for this snapshot's entry, or null if either the entry has changed since this snapshot was created or if another edit is in progress.- Throws:
IOException
-
getInputStream
Returns the unbuffered stream with the value forindex. -
getString
Returns the string value forindex.- Throws:
IOException
-
getLength
public long getLength(int index)Returns the byte length of the value forindex. -
close
public void close()Description copied from interface:CloseableCloses the object and release any system resources it holds.Although only the first call has any effect, it is safe to call close multiple times on the same object. This is more lenient than the overridden
AutoCloseable.close(), which may be called at most once.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-