diff --git a/src/main/java/com/jakewharton/DiskLruCache.java b/src/main/java/com/jakewharton/DiskLruCache.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/jakewharton/DiskLruCache.java
+++ b/src/main/java/com/jakewharton/DiskLruCache.java
@@ -771,6 +771,7 @@ public final class DiskLruCache implements Closeable {
     public final class Editor {
         private final Entry entry;
         private boolean hasErrors;
+        private boolean committed;
 
         private Editor(Entry entry) {
             this.entry = entry;
@@ -849,6 +850,7 @@ public final class DiskLruCache implements Closeable {
             } else {
                 completeEdit(this, true);
             }
+            committed = true;
         }
 
         /**
@@ -859,6 +861,15 @@ public final class DiskLruCache implements Closeable {
             completeEdit(this, false);
         }
 
+        public void abortUnlessCommitted() {
+            if (!committed) {
+                try {
+                    abort();
+                } catch (IOException ignored) {
+                }
+            }
+        }
+
         private class FaultHidingOutputStream extends FilterOutputStream {
             private FaultHidingOutputStream(OutputStream out) {
                 super(out);
Add `abortUnlessCommitted` method for use in `finally` blocks.