Module bus.http

Class DiskLruCache.Snapshot

java.lang.Object
org.miaixz.bus.http.cache.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
    void
    Closes this snapshot.
    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.
    long
    getLength(int index)
    Returns the byte length of the value for index.
    org.miaixz.bus.core.io.source.Source
    getSource(int index)
    Returns the unbuffered stream with the value for index.
    key()
    Returns the key for this snapshot.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • key

      public String key()
      Returns the key for this snapshot.
      Returns:
      the key.
    • edit

      public DiskLruCache.Editor edit() throws IOException
      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.
      Returns:
      an editor or null.
      Throws:
      IOException - if an I/O error occurs.
    • getSource

      public org.miaixz.bus.core.io.source.Source getSource(int index)
      Returns the unbuffered stream with the value for index.
      Parameters:
      index - the index of the value.
      Returns:
      the source for the value.
    • getLength

      public long getLength(int index)
      Returns the byte length of the value for index.
      Parameters:
      index - the index of the value.
      Returns:
      the length of the value.
    • close

      public void close()
      Closes this snapshot.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable