/** * @param listener An optional listener. * @param maxPacketSize The maximum datagram packet size, in bytes. * @param socketTimeoutMillis The socket timeout in milliseconds. A timeout of zero is interpreted * as an infinite timeout. */ public CameraDataSource(TransferListener listener, int maxPacketSize, int socketTimeoutMillis) { this.listener = listener; this.socketTimeoutMillis = socketTimeoutMillis; packetBuffer = new byte[maxPacketSize]; packet = new DatagramPacket(packetBuffer, 0, maxPacketSize); }
/** * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a {@link HttpDataSource.InvalidContentTypeException} * is thrown from {@link #open(DataSpec)}. * @param listener An optional listener. * @param cacheControl An optional {@link CacheControl} which sets all requests' * Cache-Control header. For example, you could force the network * response for all requests. */ private OkHttpDataSource(String userAgent, Predicate<String> contentTypePredicate, TransferListener listener, CacheControl cacheControl) { DmlApplication.getInstance().getBackendComponent().inject(this); Assertions.checkNotNull(callFactory); this.userAgent = Assertions.checkNotEmpty(userAgent); this.contentTypePredicate = contentTypePredicate; this.listener = listener; this.cacheControl = cacheControl; this.requestProperties = new HashMap<>(); }
private static UriDataSource createDataSource(Context context, String userAgent, TransferListener transferListener) { return new DefaultUriDataSource( context, transferListener, new OkHttpDataSource(userAgent, null, transferListener) ); }
/** * @param listener An optional listener. */ public CameraDataSource(TransferListener listener) { this(listener, DEFAULT_MAX_PACKET_SIZE); }
protected OkHttpDataSource createDataSource(OkHttpClient okHttpClient , TransferListener transferListener, String userAgent) { return new OkHttpDataSource(okHttpClient, userAgent, null, transferListener); }
/** * @param client An {@link OkHttpClient} for use by the source. * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a * {@link com.google.android.exoplayer.upstream.HttpDataSource.InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. * @param listener An optional listener. * @param cacheControl An optional {@link CacheControl} which sets all requests' Cache-Control * header. For example, you could force the network response for all requests. */ public OkHttpDataSource(OkHttpClient client, String userAgent, Predicate<String> contentTypePredicate, TransferListener listener, CacheControl cacheControl) { this.okHttpClient = Assertions.checkNotNull(client); this.userAgent = Assertions.checkNotEmpty(userAgent); this.contentTypePredicate = contentTypePredicate; this.listener = listener; this.cacheControl = cacheControl; this.requestProperties = new HashMap<>(); }
/** * @param client An {@link OkHttpClient} for use by the source. * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a * {@link com.google.android.exoplayer.upstream.HttpDataSource.InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. * @param listener An optional listener. * @param cacheControl An optional {@link CacheControl} which sets all requests' Cache-Control * header. For example, you could force the network response for all requests. * */ public OkHttpDataSource(OkHttpClient client, String userAgent, Predicate<String> contentTypePredicate, TransferListener listener, CacheControl cacheControl) { this.okHttpClient = Assertions.checkNotNull(client); this.userAgent = Assertions.checkNotEmpty(userAgent); this.contentTypePredicate = contentTypePredicate; this.listener = listener; this.cacheControl = cacheControl; this.requestProperties = new HashMap<>(); }
/** * @param client An {@link OkHttpClient} for use by the source. * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a * {@link InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. * @param listener An optional listener. * @param cacheControl An optional {@link CacheControl} which sets all requests' Cache-Control * header. For example, you could force the network response for all requests. * */ public OkHttpDataSource(OkHttpClient client, String userAgent, Predicate<String> contentTypePredicate, TransferListener listener, CacheControl cacheControl) { this.okHttpClient = Assertions.checkNotNull(client); this.userAgent = Assertions.checkNotEmpty(userAgent); this.contentTypePredicate = contentTypePredicate; this.listener = listener; this.cacheControl = cacheControl; this.requestProperties = new HashMap<>(); }
/** * @param listener An optional listener. * @param maxPacketSize The maximum datagram packet size, in bytes. */ public CameraDataSource(TransferListener listener, int maxPacketSize) { this(listener, maxPacketSize, DEAFULT_SOCKET_TIMEOUT_MILLIS); }
/** * @param client An {@link OkHttpClient} for use by the source. * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a * {@link com.google.android.exoplayer.upstream.HttpDataSource.InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. * @param listener An optional listener. */ public OkHttpDataSource(OkHttpClient client, String userAgent, Predicate<String> contentTypePredicate, TransferListener listener) { this(client, userAgent, contentTypePredicate, listener, null); }
/** * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a {@link HttpDataSource.InvalidContentTypeException} * is thrown from {@link #open(DataSpec)}. * @param listener An optional listener. */ public OkHttpDataSource(String userAgent, Predicate<String> contentTypePredicate, TransferListener listener) { this(userAgent, contentTypePredicate, listener, null); }
/** * @param client An {@link OkHttpClient} for use by the source. * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a * {@link InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. * @param listener An optional listener. */ public OkHttpDataSource(OkHttpClient client, String userAgent, Predicate<String> contentTypePredicate, TransferListener listener) { this(client, userAgent, contentTypePredicate, listener, null); }
DataSource create(Context context, TransferListener listener, String userAgent);