Module bus.http

Class DiskLruCache.Editor

java.lang.Object
org.miaixz.bus.http.cache.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
    void
    Aborts this edit.
    void
    Aborts this edit unless it has been committed.
    void
    Commits this edit so it is visible to readers.
    org.miaixz.bus.core.io.sink.Sink
    newSink(int index)
    Returns a new unbuffered output stream to write the value at index.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 at index. If the underlying output stream encounters errors when writing to the filesystem, this edit will be aborted when commit() is called. The returned output stream does not throw IOExceptions.
      Parameters:
      index - the index of the value.
      Returns:
      a sink for the value.
    • commit

      public void commit() throws IOException
      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

      public void abort() throws IOException
      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.