1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-18 20:40:58 +03:00

Delete some dead code.

This commit is contained in:
Jesse Wilson
2014-04-19 20:37:32 -04:00
parent 23774087db
commit 09e734c812
3 changed files with 7 additions and 38 deletions

View File

@@ -663,8 +663,13 @@ public final class DiskLruCache implements Closeable {
}
private static String inputStreamToString(InputStream in) throws IOException {
Buffer buffer = Util.readFully(Okio.source(in));
return buffer.readUtf8(buffer.size());
try {
Buffer buffer = new Buffer();
buffer.writeAll(Okio.source(in));
return buffer.readUtf8();
} finally {
Util.closeQuietly(in);
}
}
/** A snapshot of the values for an entry. */

View File

@@ -18,7 +18,6 @@ package com.squareup.okhttp.internal;
import com.squareup.okhttp.Protocol;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
@@ -34,7 +33,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.Deflater;
import java.util.zip.DeflaterOutputStream;
import javax.net.ssl.SSLSocket;
import okio.Buffer;
@@ -126,32 +124,6 @@ public class Platform {
socket.connect(address, connectTimeout);
}
/**
* Returns a deflater output stream that supports SYNC_FLUSH for SPDY name
* value blocks. This throws an {@link UnsupportedOperationException} on
* Java 6 and earlier where there is no built-in API to do SYNC_FLUSH.
*/
public OutputStream newDeflaterOutputStream(OutputStream out, Deflater deflater,
boolean syncFlush) {
try {
Constructor<DeflaterOutputStream> constructor = deflaterConstructor;
if (constructor == null) {
constructor = deflaterConstructor = DeflaterOutputStream.class.getConstructor(
OutputStream.class, Deflater.class, boolean.class);
}
return constructor.newInstance(out, deflater, syncFlush);
} catch (NoSuchMethodException e) {
throw new UnsupportedOperationException("Cannot SPDY; no SYNC_FLUSH available");
} catch (InvocationTargetException e) {
throw e.getCause() instanceof RuntimeException ? (RuntimeException) e.getCause()
: new RuntimeException(e.getCause());
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new AssertionError();
}
}
/** Attempt to match the host runtime to a capable Platform implementation. */
private static Platform findPlatform() {
// Attempt to find Android 2.3+ APIs.

View File

@@ -180,14 +180,6 @@ public final class Util {
}
}
/** Returns the remainder of 'source' as a buffer, closing it when done. */
public static Buffer readFully(Source source) throws IOException {
Buffer result = new Buffer();
result.writeAll(source);
source.close();
return result;
}
/** Reads until {@code in} is exhausted or the timeout has elapsed. */
public static boolean skipAll(Source in, int timeoutMillis) throws IOException {
// TODO: Implement deadlines everywhere so they can do this work.