com.google.android.exoplayer2.util.Predicate Java Examples

The following examples show how to use com.google.android.exoplayer2.util.Predicate. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GSYDefaultHttpDataSource.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
/**
 * @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 connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
 *                             interpreted as an infinite timeout.
 * @param readTimeoutMillis    The read timeout, in milliseconds. A timeout of zero is interpreted as
 *                             an infinite timeout.
 * @deprecated Use {@link #GSYDefaultHttpDataSource(String, int, int)} and {@link
 * #setContentTypePredicate(Predicate)}.
 */
@SuppressWarnings("deprecation")
@Deprecated
public GSYDefaultHttpDataSource(
        String userAgent,
        @Nullable Predicate<String> contentTypePredicate,
        int connectTimeoutMillis,
        int readTimeoutMillis) {
    this(
            userAgent,
            contentTypePredicate,
            connectTimeoutMillis,
            readTimeoutMillis,
            /* allowCrossProtocolRedirects= */ false,
            /* defaultRequestProperties= */ null);
}
 
Example #2
Source File: DefaultHttpDataSource.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @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 connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
 *     interpreted as an infinite timeout. Pass {@link #DEFAULT_CONNECT_TIMEOUT_MILLIS} to use the
 *     default value.
 * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted as
 *     an infinite timeout. Pass {@link #DEFAULT_READ_TIMEOUT_MILLIS} to use the default value.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *     to HTTPS and vice versa) are enabled.
 * @param defaultRequestProperties The default request properties to be sent to the server as HTTP
 *     headers or {@code null} if not required.
 * @deprecated Use {@link #DefaultHttpDataSource(String, Predicate, int, int, boolean,
 *     RequestProperties)} and {@link #addTransferListener(TransferListener)}.
 */
@Deprecated
public DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    @Nullable TransferListener listener,
    int connectTimeoutMillis,
    int readTimeoutMillis,
    boolean allowCrossProtocolRedirects,
    @Nullable RequestProperties defaultRequestProperties) {
  this(
      userAgent,
      contentTypePredicate,
      connectTimeoutMillis,
      readTimeoutMillis,
      allowCrossProtocolRedirects,
      defaultRequestProperties);
  if (listener != null) {
    addTransferListener(listener);
  }
}
 
Example #3
Source File: DefaultHttpDataSource.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @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 connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
 *     interpreted as an infinite timeout. Pass {@link #DEFAULT_CONNECT_TIMEOUT_MILLIS} to use the
 *     default value.
 * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted as
 *     an infinite timeout. Pass {@link #DEFAULT_READ_TIMEOUT_MILLIS} to use the default value.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *     to HTTPS and vice versa) are enabled.
 * @param defaultRequestProperties The default request properties to be sent to the server as HTTP
 *     headers or {@code null} if not required.
 */
public DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    int connectTimeoutMillis,
    int readTimeoutMillis,
    boolean allowCrossProtocolRedirects,
    @Nullable RequestProperties defaultRequestProperties) {
  super(/* isNetwork= */ true);
  this.userAgent = Assertions.checkNotEmpty(userAgent);
  this.contentTypePredicate = contentTypePredicate;
  this.requestProperties = new RequestProperties();
  this.connectTimeoutMillis = connectTimeoutMillis;
  this.readTimeoutMillis = readTimeoutMillis;
  this.allowCrossProtocolRedirects = allowCrossProtocolRedirects;
  this.defaultRequestProperties = defaultRequestProperties;
}
 
Example #4
Source File: DefaultHttpDataSource.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @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 connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
 *     interpreted as an infinite timeout. Pass {@link #DEFAULT_CONNECT_TIMEOUT_MILLIS} to use the
 *     default value.
 * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted as
 *     an infinite timeout. Pass {@link #DEFAULT_READ_TIMEOUT_MILLIS} to use the default value.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *     to HTTPS and vice versa) are enabled.
 * @param defaultRequestProperties The default request properties to be sent to the server as HTTP
 *     headers or {@code null} if not required.
 * @deprecated Use {@link #DefaultHttpDataSource(String, Predicate, int, int, boolean,
 *     RequestProperties)} and {@link #addTransferListener(TransferListener)}.
 */
@Deprecated
public DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    @Nullable TransferListener listener,
    int connectTimeoutMillis,
    int readTimeoutMillis,
    boolean allowCrossProtocolRedirects,
    @Nullable RequestProperties defaultRequestProperties) {
  this(
      userAgent,
      contentTypePredicate,
      connectTimeoutMillis,
      readTimeoutMillis,
      allowCrossProtocolRedirects,
      defaultRequestProperties);
  if (listener != null) {
    addTransferListener(listener);
  }
}
 
Example #5
Source File: DefaultHttpDataSource.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @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 connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
 *     interpreted as an infinite timeout. Pass {@link #DEFAULT_CONNECT_TIMEOUT_MILLIS} to use the
 *     default value.
 * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted as
 *     an infinite timeout. Pass {@link #DEFAULT_READ_TIMEOUT_MILLIS} to use the default value.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *     to HTTPS and vice versa) are enabled.
 * @param defaultRequestProperties The default request properties to be sent to the server as HTTP
 *     headers or {@code null} if not required.
 */
public DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    int connectTimeoutMillis,
    int readTimeoutMillis,
    boolean allowCrossProtocolRedirects,
    @Nullable RequestProperties defaultRequestProperties) {
  super(/* isNetwork= */ true);
  this.userAgent = Assertions.checkNotEmpty(userAgent);
  this.contentTypePredicate = contentTypePredicate;
  this.requestProperties = new RequestProperties();
  this.connectTimeoutMillis = connectTimeoutMillis;
  this.readTimeoutMillis = readTimeoutMillis;
  this.allowCrossProtocolRedirects = allowCrossProtocolRedirects;
  this.defaultRequestProperties = defaultRequestProperties;
}
 
Example #6
Source File: GSYDefaultHttpDataSource.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
/**
 * @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 connectTimeoutMillis        The connection timeout, in milliseconds. A timeout of zero is
 *                                    interpreted as an infinite timeout. Pass {@link #DEFAULT_CONNECT_TIMEOUT_MILLIS} to use the
 *                                    default value.
 * @param readTimeoutMillis           The read timeout, in milliseconds. A timeout of zero is interpreted as
 *                                    an infinite timeout. Pass {@link #DEFAULT_READ_TIMEOUT_MILLIS} to use the default value.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *                                    to HTTPS and vice versa) are enabled.
 * @param defaultRequestProperties    The default request properties to be sent to the server as HTTP
 *                                    headers or {@code null} if not required.
 * @deprecated Use {@link #GSYDefaultHttpDataSource(String, int, int, boolean, RequestProperties)}
 * and {@link #setContentTypePredicate(Predicate)}.
 */
@Deprecated
public GSYDefaultHttpDataSource(
        String userAgent,
        @Nullable Predicate<String> contentTypePredicate,
        int connectTimeoutMillis,
        int readTimeoutMillis,
        boolean allowCrossProtocolRedirects,
        @Nullable RequestProperties defaultRequestProperties) {
    super(/* isNetwork= */ true);
    this.userAgent = Assertions.checkNotEmpty(userAgent);
    this.contentTypePredicate = contentTypePredicate;
    this.requestProperties = new RequestProperties();
    this.connectTimeoutMillis = connectTimeoutMillis;
    this.readTimeoutMillis = readTimeoutMillis;
    this.allowCrossProtocolRedirects = allowCrossProtocolRedirects;
    this.defaultRequestProperties = defaultRequestProperties;
}
 
Example #7
Source File: DefaultHttpDataSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @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 connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
 *     interpreted as an infinite timeout. Pass {@link #DEFAULT_CONNECT_TIMEOUT_MILLIS} to use the
 *     default value.
 * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted as
 *     an infinite timeout. Pass {@link #DEFAULT_READ_TIMEOUT_MILLIS} to use the default value.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *     to HTTPS and vice versa) are enabled.
 * @param defaultRequestProperties The default request properties to be sent to the server as HTTP
 *     headers or {@code null} if not required.
 */
public DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    @Nullable TransferListener listener,
    int connectTimeoutMillis,
    int readTimeoutMillis,
    boolean allowCrossProtocolRedirects,
    @Nullable RequestProperties defaultRequestProperties) {
  super(/* isNetwork= */ true);
  this.userAgent = Assertions.checkNotEmpty(userAgent);
  this.contentTypePredicate = contentTypePredicate;
  this.requestProperties = new RequestProperties();
  this.connectTimeoutMillis = connectTimeoutMillis;
  this.readTimeoutMillis = readTimeoutMillis;
  this.allowCrossProtocolRedirects = allowCrossProtocolRedirects;
  this.defaultRequestProperties = defaultRequestProperties;
  if (listener != null) {
    addTransferListener(listener);
  }
}
 
Example #8
Source File: DefaultHttpDataSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @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 connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
 *     interpreted as an infinite timeout. Pass {@link #DEFAULT_CONNECT_TIMEOUT_MILLIS} to use the
 *     default value.
 * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted as
 *     an infinite timeout. Pass {@link #DEFAULT_READ_TIMEOUT_MILLIS} to use the default value.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *     to HTTPS and vice versa) are enabled.
 * @param defaultRequestProperties The default request properties to be sent to the server as HTTP
 *     headers or {@code null} if not required.
 */
public DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    @Nullable TransferListener listener,
    int connectTimeoutMillis,
    int readTimeoutMillis,
    boolean allowCrossProtocolRedirects,
    @Nullable RequestProperties defaultRequestProperties) {
  super(/* isNetwork= */ true);
  this.userAgent = Assertions.checkNotEmpty(userAgent);
  this.contentTypePredicate = contentTypePredicate;
  this.requestProperties = new RequestProperties();
  this.connectTimeoutMillis = connectTimeoutMillis;
  this.readTimeoutMillis = readTimeoutMillis;
  this.allowCrossProtocolRedirects = allowCrossProtocolRedirects;
  this.defaultRequestProperties = defaultRequestProperties;
  if (listener != null) {
    addTransferListener(listener);
  }
}
 
Example #9
Source File: DefaultHttpDataSource.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * @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 connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
 *     interpreted as an infinite timeout.
 * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted as
 *     an infinite timeout.
 * @deprecated Use {@link #DefaultHttpDataSource(String, int, int)} and {@link
 *     #setContentTypePredicate(Predicate)}.
 */
@SuppressWarnings("deprecation")
@Deprecated
public DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    int connectTimeoutMillis,
    int readTimeoutMillis) {
  this(
      userAgent,
      contentTypePredicate,
      connectTimeoutMillis,
      readTimeoutMillis,
      /* allowCrossProtocolRedirects= */ false,
      /* defaultRequestProperties= */ null);
}
 
Example #10
Source File: DefaultHttpDataSource.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * @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 connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
 *     interpreted as an infinite timeout. Pass {@link #DEFAULT_CONNECT_TIMEOUT_MILLIS} to use the
 *     default value.
 * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted as
 *     an infinite timeout. Pass {@link #DEFAULT_READ_TIMEOUT_MILLIS} to use the default value.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *     to HTTPS and vice versa) are enabled.
 * @param defaultRequestProperties The default request properties to be sent to the server as HTTP
 *     headers or {@code null} if not required.
 * @deprecated Use {@link #DefaultHttpDataSource(String, int, int, boolean, RequestProperties)}
 *     and {@link #setContentTypePredicate(Predicate)}.
 */
@Deprecated
public DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    int connectTimeoutMillis,
    int readTimeoutMillis,
    boolean allowCrossProtocolRedirects,
    @Nullable RequestProperties defaultRequestProperties) {
  super(/* isNetwork= */ true);
  this.userAgent = Assertions.checkNotEmpty(userAgent);
  this.contentTypePredicate = contentTypePredicate;
  this.requestProperties = new RequestProperties();
  this.connectTimeoutMillis = connectTimeoutMillis;
  this.readTimeoutMillis = readTimeoutMillis;
  this.allowCrossProtocolRedirects = allowCrossProtocolRedirects;
  this.defaultRequestProperties = defaultRequestProperties;
}
 
Example #11
Source File: DefaultHttpDataSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @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)}.
 */
public DefaultHttpDataSource(String userAgent, @Nullable Predicate<String> contentTypePredicate) {
  this(
      userAgent,
      contentTypePredicate,
      DEFAULT_CONNECT_TIMEOUT_MILLIS,
      DEFAULT_READ_TIMEOUT_MILLIS);
}
 
Example #12
Source File: DefaultHttpDataSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @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 connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
 *     interpreted as an infinite timeout.
 * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted as
 *     an infinite timeout.
 */
public DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    int connectTimeoutMillis,
    int readTimeoutMillis) {
  this(
      userAgent,
      contentTypePredicate,
      connectTimeoutMillis,
      readTimeoutMillis,
      /* allowCrossProtocolRedirects= */ false,
      /* defaultRequestProperties= */ null);
}
 
Example #13
Source File: DefaultHttpDataSource.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @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.
 * @deprecated Use {@link #DefaultHttpDataSource(String, Predicate)} and {@link
 *     #addTransferListener(TransferListener)}.
 */
@Deprecated
@SuppressWarnings("deprecation")
public DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    @Nullable TransferListener listener) {
  this(userAgent, contentTypePredicate, listener, DEFAULT_CONNECT_TIMEOUT_MILLIS,
      DEFAULT_READ_TIMEOUT_MILLIS);
}
 
Example #14
Source File: DefaultHttpDataSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @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 DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    @Nullable TransferListener listener) {
  this(userAgent, contentTypePredicate, listener, DEFAULT_CONNECT_TIMEOUT_MILLIS,
      DEFAULT_READ_TIMEOUT_MILLIS);
}
 
Example #15
Source File: DefaultHttpDataSource.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * @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)}.
 * @deprecated Use {@link #DefaultHttpDataSource(String)} and {@link
 *     #setContentTypePredicate(Predicate)}.
 */
@Deprecated
public DefaultHttpDataSource(String userAgent, @Nullable Predicate<String> contentTypePredicate) {
  this(
      userAgent,
      contentTypePredicate,
      DEFAULT_CONNECT_TIMEOUT_MILLIS,
      DEFAULT_READ_TIMEOUT_MILLIS);
}
 
Example #16
Source File: GSYDefaultHttpDataSource.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * @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)}.
 * @deprecated Use {@link #GSYDefaultHttpDataSource(String)} and {@link
 * #setContentTypePredicate(Predicate)}.
 */
@Deprecated
public GSYDefaultHttpDataSource(String userAgent, @Nullable Predicate<String> contentTypePredicate) {
    this(
            userAgent,
            contentTypePredicate,
            DEFAULT_CONNECT_TIMEOUT_MILLIS,
            DEFAULT_READ_TIMEOUT_MILLIS);
}
 
Example #17
Source File: DefaultHttpDataSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @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)}.
 */
public DefaultHttpDataSource(String userAgent, @Nullable Predicate<String> contentTypePredicate) {
  this(
      userAgent,
      contentTypePredicate,
      DEFAULT_CONNECT_TIMEOUT_MILLIS,
      DEFAULT_READ_TIMEOUT_MILLIS);
}
 
Example #18
Source File: DefaultHttpDataSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @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 connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
 *     interpreted as an infinite timeout.
 * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted as
 *     an infinite timeout.
 */
public DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    int connectTimeoutMillis,
    int readTimeoutMillis) {
  this(
      userAgent,
      contentTypePredicate,
      connectTimeoutMillis,
      readTimeoutMillis,
      /* allowCrossProtocolRedirects= */ false,
      /* defaultRequestProperties= */ null);
}
 
Example #19
Source File: DefaultHttpDataSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @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 DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    @Nullable TransferListener listener) {
  this(userAgent, contentTypePredicate, listener, DEFAULT_CONNECT_TIMEOUT_MILLIS,
      DEFAULT_READ_TIMEOUT_MILLIS);
}
 
Example #20
Source File: DefaultHttpDataSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @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.
 * @deprecated Use {@link #DefaultHttpDataSource(String, Predicate)} and {@link
 *     #addTransferListener(TransferListener)}.
 */
@Deprecated
@SuppressWarnings("deprecation")
public DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    @Nullable TransferListener listener) {
  this(userAgent, contentTypePredicate, listener, DEFAULT_CONNECT_TIMEOUT_MILLIS,
      DEFAULT_READ_TIMEOUT_MILLIS);
}
 
Example #21
Source File: IcyHttpDataSource.java    From android-exoplayer2-ext-icy with Apache License 2.0 5 votes vote down vote up
private IcyHttpDataSource(
        @NonNull Call.Factory callFactory,
        @Nullable final String userAgent,
        @Nullable final Predicate<String> contentTypePredicate,
        @Nullable CacheControl cacheControl,
        @NonNull RequestProperties defaultRequestProperties) {
    super(callFactory, userAgent, contentTypePredicate, cacheControl, defaultRequestProperties);
    defaultRequestProperties.set(REQUEST_HEADER_ICY_METAINT_KEY, REQUEST_HEADER_ICY_METAINT_VALUE);

    // See class Builder
}
 
Example #22
Source File: ArviHttpDataSource.java    From ARVI with Apache License 2.0 5 votes vote down vote up
public ArviHttpDataSource(String userAgent,
                          Predicate<String> contentTypePredicate,
                          int connectTimeoutMillis,
                          int readTimeoutMillis,
                          boolean allowCrossProtocolRedirects,
                          RequestProperties defaultRequestProperties) {
    super(
        userAgent,
        contentTypePredicate,
        connectTimeoutMillis,
        readTimeoutMillis,
        allowCrossProtocolRedirects,
        defaultRequestProperties
    );
}
 
Example #23
Source File: ArviHttpDataSource.java    From ARVI with Apache License 2.0 5 votes vote down vote up
public ArviHttpDataSource(String userAgent,
                          Predicate<String> contentTypePredicate,
                          int connectTimeoutMillis,
                          int readTimeoutMillis) {
    super(
        userAgent,
        contentTypePredicate,
        connectTimeoutMillis,
        readTimeoutMillis
    );
}
 
Example #24
Source File: ArviHttpDataSource.java    From ARVI with Apache License 2.0 4 votes vote down vote up
public ArviHttpDataSource(String userAgent, Predicate<String> contentTypePredicate) {
    super(userAgent, contentTypePredicate);
}
 
Example #25
Source File: IcyHttpDataSourceFactory.java    From android-exoplayer2-ext-icy with Apache License 2.0 4 votes vote down vote up
public Builder setContentTypePredicate(@NonNull final Predicate<String> contentTypePredicate) {
    factory.contentTypePredicate = contentTypePredicate;
    return this;
}
 
Example #26
Source File: IcyHttpDataSource.java    From android-exoplayer2-ext-icy with Apache License 2.0 4 votes vote down vote up
public Builder setContentTypePredicate(@NonNull final Predicate<String> contentTypePredicate) {
    this.contentTypePredicate = contentTypePredicate;
    return this;
}
 
Example #27
Source File: DefaultHttpDataSource.java    From K-Sonic with MIT License 3 votes vote down vote up
/**
 * @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 connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
 *     interpreted as an infinite timeout.
 * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted
 *     as an infinite timeout.
 */
public DefaultHttpDataSource(String userAgent, Predicate<String> contentTypePredicate,
    TransferListener<? super DefaultHttpDataSource> listener, int connectTimeoutMillis,
    int readTimeoutMillis) {
  this(userAgent, contentTypePredicate, listener, connectTimeoutMillis, readTimeoutMillis, false,
      null);
}
 
Example #28
Source File: DefaultHttpDataSource.java    From K-Sonic with MIT License 3 votes vote down vote up
/**
 * @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 connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
 *     interpreted as an infinite timeout. Pass {@link #DEFAULT_CONNECT_TIMEOUT_MILLIS} to use
 *     the default value.
 * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted
 *     as an infinite timeout. Pass {@link #DEFAULT_READ_TIMEOUT_MILLIS} to use the default value.
 * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP
 *     to HTTPS and vice versa) are enabled.
 * @param defaultRequestProperties The default request properties to be sent to the server as
 *     HTTP headers or {@code null} if not required.
 */
public DefaultHttpDataSource(String userAgent, Predicate<String> contentTypePredicate,
    TransferListener<? super DefaultHttpDataSource> listener, int connectTimeoutMillis,
    int readTimeoutMillis, boolean allowCrossProtocolRedirects,
    RequestProperties defaultRequestProperties) {
  this.userAgent = Assertions.checkNotEmpty(userAgent);
  this.contentTypePredicate = contentTypePredicate;
  this.listener = listener;
  this.requestProperties = new RequestProperties();
  this.connectTimeoutMillis = connectTimeoutMillis;
  this.readTimeoutMillis = readTimeoutMillis;
  this.allowCrossProtocolRedirects = allowCrossProtocolRedirects;
  this.defaultRequestProperties = defaultRequestProperties;
}
 
Example #29
Source File: DefaultHttpDataSource.java    From Telegram-FOSS with GNU General Public License v2.0 3 votes vote down vote up
/**
 * @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 connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
 *     interpreted as an infinite timeout.
 * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted as
 *     an infinite timeout.
 * @deprecated Use {@link #DefaultHttpDataSource(String, Predicate, int, int)} and {@link
 *     #addTransferListener(TransferListener)}.
 */
@Deprecated
@SuppressWarnings("deprecation")
public DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    @Nullable TransferListener listener,
    int connectTimeoutMillis,
    int readTimeoutMillis) {
  this(userAgent, contentTypePredicate, listener, connectTimeoutMillis, readTimeoutMillis, false,
      null);
}
 
Example #30
Source File: DefaultHttpDataSource.java    From TelePlus-Android with GNU General Public License v2.0 3 votes vote down vote up
/**
 * @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 connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is
 *     interpreted as an infinite timeout.
 * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted as
 *     an infinite timeout.
 */
public DefaultHttpDataSource(
    String userAgent,
    @Nullable Predicate<String> contentTypePredicate,
    @Nullable TransferListener listener,
    int connectTimeoutMillis,
    int readTimeoutMillis) {
  this(userAgent, contentTypePredicate, listener, connectTimeoutMillis, readTimeoutMillis, false,
      null);
}