Class DiskLruCache.Editor

  • Enclosing class:
    DiskLruCache


    public final class DiskLruCache.Editor
    extends Object
    Edits the values for an entry.
    • Method Summary

      Modifier and Type Method and Description
      void abort()
      Aborts this edit.
      void abortUnlessCommitted()
       
      void commit()
      Commits this edit so it is visible to readers.
      okio.Sink newSink(int index)
      Returns a new unbuffered output stream to write the value at index.
      okio.Source newSource(int index)
      Returns an unbuffered input stream to read the last committed value, or null if no value has been committed.
    • Method Detail

      • newSource

        public okio.Source newSource(int index)
                              throws IOException
        Returns an unbuffered input stream to read the last committed value, or null if no value has been committed.
        Throws:
        IOException
      • newSink

        public okio.Sink newSink(int index)
                          throws IOException
        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.
        Throws:
        IOException
      • 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
      • 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
      • abortUnlessCommitted

        public void abortUnlessCommitted()