From ba1edd048e5fae9ee97fc9b524e251ae7254c0e6 Mon Sep 17 00:00:00 2001 From: jwilson Date: Sun, 28 Aug 2016 18:13:42 -0400 Subject: [PATCH] Upgrade to Okio 1.10. --- .../okhttp3/internal/cache/DiskLruCache.java | 24 +++---------------- pom.xml | 2 +- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/okhttp/src/main/java/okhttp3/internal/cache/DiskLruCache.java b/okhttp/src/main/java/okhttp3/internal/cache/DiskLruCache.java index 8b7b7f2a0..4d3ef616a 100644 --- a/okhttp/src/main/java/okhttp3/internal/cache/DiskLruCache.java +++ b/okhttp/src/main/java/okhttp3/internal/cache/DiskLruCache.java @@ -35,13 +35,11 @@ import java.util.regex.Pattern; import okhttp3.internal.Util; import okhttp3.internal.io.FileSystem; import okhttp3.internal.platform.Platform; -import okio.Buffer; import okio.BufferedSink; import okio.BufferedSource; import okio.Okio; import okio.Sink; import okio.Source; -import okio.Timeout; import static okhttp3.internal.platform.Platform.WARN; @@ -187,7 +185,7 @@ public final class DiskLruCache implements Closeable, Flushable { } } catch (IOException e) { mostRecentRebuildFailed = true; - journalWriter = Okio.buffer(NULL_SINK); + journalWriter = Okio.buffer(Okio.blackhole()); } } } @@ -822,22 +820,6 @@ public final class DiskLruCache implements Closeable, Flushable { } } - private static final Sink NULL_SINK = new Sink() { - @Override public void write(Buffer source, long byteCount) throws IOException { - source.skip(byteCount); - } - - @Override public void flush() throws IOException { - } - - @Override public Timeout timeout() { - return Timeout.NONE; - } - - @Override public void close() throws IOException { - } - }; - /** Edits the values for an entry. */ public final class Editor { private final Entry entry; @@ -899,7 +881,7 @@ public final class DiskLruCache implements Closeable, Flushable { throw new IllegalStateException(); } if (entry.currentEditor != this) { - return NULL_SINK; + return Okio.blackhole(); } if (!entry.readable) { written[index] = true; @@ -909,7 +891,7 @@ public final class DiskLruCache implements Closeable, Flushable { try { sink = fileSystem.sink(dirtyFile); } catch (FileNotFoundException e) { - return NULL_SINK; + return Okio.blackhole(); } return new FaultHidingSink(sink) { @Override protected void onException(IOException e) { diff --git a/pom.xml b/pom.xml index d769d52c2..1b548b8b2 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ 16.0 1.7 1.1.0 - 1.9.0 + 1.10.0 4.12