Commit 0cff74dc by olly Committed by Oliver Woodman

Clean up okhttp extension Javadoc

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136702598
parent e4bafd96
...@@ -65,7 +65,8 @@ public class OkHttpDataSource implements HttpDataSource { ...@@ -65,7 +65,8 @@ public class OkHttpDataSource implements HttpDataSource {
private long bytesRead; private long bytesRead;
/** /**
* @param callFactory A {@link Call.Factory} for use by the source. * @param callFactory A {@link Call.Factory} (typically an {@link okhttp3.OkHttpClient}) for use
* by the source.
* @param userAgent The User-Agent string that should be used. * @param userAgent The User-Agent string that should be used.
* @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the
* predicate then a InvalidContentTypeException} is thrown from {@link #open(DataSpec)}. * predicate then a InvalidContentTypeException} is thrown from {@link #open(DataSpec)}.
...@@ -76,7 +77,8 @@ public class OkHttpDataSource implements HttpDataSource { ...@@ -76,7 +77,8 @@ public class OkHttpDataSource implements HttpDataSource {
} }
/** /**
* @param callFactory A {@link Call.Factory} for use by the source. * @param callFactory A {@link Call.Factory} (typically an {@link okhttp3.OkHttpClient}) for use
* by the source.
* @param userAgent The User-Agent string that should be used. * @param userAgent The User-Agent string that should be used.
* @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the
* predicate then a {@link InvalidContentTypeException} is thrown from * predicate then a {@link InvalidContentTypeException} is thrown from
...@@ -89,14 +91,14 @@ public class OkHttpDataSource implements HttpDataSource { ...@@ -89,14 +91,14 @@ public class OkHttpDataSource implements HttpDataSource {
} }
/** /**
* @param callFactory An {@link Call.Factory} for use by the source. * @param callFactory A {@link Call.Factory} (typically an {@link okhttp3.OkHttpClient}) for use
* by the source.
* @param userAgent The User-Agent string that should be used. * @param userAgent The User-Agent string that should be used.
* @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the
* predicate then a {@link InvalidContentTypeException} is thrown from * predicate then a {@link InvalidContentTypeException} is thrown from
* {@link #open(DataSpec)}. * {@link #open(DataSpec)}.
* @param listener An optional listener. * @param listener An optional listener.
* @param cacheControl An optional {@link CacheControl} which sets all requests' Cache-Control * @param cacheControl An optional {@link CacheControl} for setting the Cache-Control header.
* header. For example, you could force the network response for all requests.
*/ */
public OkHttpDataSource(Call.Factory callFactory, String userAgent, public OkHttpDataSource(Call.Factory callFactory, String userAgent,
Predicate<String> contentTypePredicate, TransferListener<? super OkHttpDataSource> listener, Predicate<String> contentTypePredicate, TransferListener<? super OkHttpDataSource> listener,
......
...@@ -28,25 +28,38 @@ public final class OkHttpDataSourceFactory implements Factory { ...@@ -28,25 +28,38 @@ public final class OkHttpDataSourceFactory implements Factory {
private final Call.Factory callFactory; private final Call.Factory callFactory;
private final String userAgent; private final String userAgent;
private final TransferListener<? super DataSource> transferListener; private final TransferListener<? super DataSource> listener;
private final CacheControl cacheControl; private final CacheControl cacheControl;
/**
* @param callFactory A {@link Call.Factory} (typically an {@link okhttp3.OkHttpClient}) for use
* by the sources created by the factory.
* @param userAgent The User-Agent string that should be used.
* @param listener An optional listener.
*/
public OkHttpDataSourceFactory(Call.Factory callFactory, String userAgent, public OkHttpDataSourceFactory(Call.Factory callFactory, String userAgent,
TransferListener<? super DataSource> transferListener) { TransferListener<? super DataSource> listener) {
this(callFactory, userAgent, transferListener, null); this(callFactory, userAgent, listener, null);
} }
/**
* @param callFactory A {@link Call.Factory} (typically an {@link okhttp3.OkHttpClient}) for use
* by the sources created by the factory.
* @param userAgent The User-Agent string that should be used.
* @param listener An optional listener.
* @param cacheControl An optional {@link CacheControl} for setting the Cache-Control header.
*/
public OkHttpDataSourceFactory(Call.Factory callFactory, String userAgent, public OkHttpDataSourceFactory(Call.Factory callFactory, String userAgent,
TransferListener<? super DataSource> transferListener, CacheControl cacheControl) { TransferListener<? super DataSource> listener, CacheControl cacheControl) {
this.callFactory = callFactory; this.callFactory = callFactory;
this.userAgent = userAgent; this.userAgent = userAgent;
this.transferListener = transferListener; this.listener = listener;
this.cacheControl = cacheControl; this.cacheControl = cacheControl;
} }
@Override @Override
public OkHttpDataSource createDataSource() { public OkHttpDataSource createDataSource() {
return new OkHttpDataSource(callFactory, userAgent, null, transferListener, cacheControl); return new OkHttpDataSource(callFactory, userAgent, null, listener, cacheControl);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment