DataSpec { public DataSpec subrange(long offset) { return subrange(offset, length == C.LENGTH_UNSET ? C.LENGTH_UNSET : length - offset); } DataSpec(Uri uri);  DataSpec(Uri uri, @Flags int flags);  DataSpec(Uri uri, long absoluteStreamPosition, long length, @Nullable String key);  DataSpec(
      Uri uri, long absoluteStreamPosition, long length, @Nullable String key, @Flags int flags);  DataSpec(
      Uri uri,
      long absoluteStreamPosition,
      long length,
      @Nullable String key,
      @Flags int flags,
      Map<String, String> httpRequestHeaders);  DataSpec(
      Uri uri,
      long absoluteStreamPosition,
      long position,
      long length,
      @Nullable String key,
      @Flags int flags);  DataSpec(
      Uri uri,
      @Nullable byte[] postBody,
      long absoluteStreamPosition,
      long position,
      long length,
      @Nullable String key,
      @Flags int flags);  DataSpec(
      Uri uri,
      @HttpMethod int httpMethod,
      @Nullable byte[] httpBody,
      long absoluteStreamPosition,
      long position,
      long length,
      @Nullable String key,
      @Flags int flags);  DataSpec(
      Uri uri,
      @HttpMethod int httpMethod,
      @Nullable byte[] httpBody,
      long absoluteStreamPosition,
      long position,
      long length,
      @Nullable String key,
      @Flags int flags,
      Map<String, String> httpRequestHeaders); boolean isFlagSet(@Flags int flag); @Override String toString(); final String getHttpMethodString(); static String getStringForHttpMethod(@HttpMethod int httpMethod); DataSpec subrange(long offset); DataSpec subrange(long offset, long length); DataSpec withUri(Uri uri); DataSpec withRequestHeaders(Map<String, String> requestHeaders); DataSpec withAdditionalHeaders(Map<String, String> requestHeaders); static final int FLAG_ALLOW_GZIP; static final int FLAG_DONT_CACHE_IF_LENGTH_UNKNOWN; static final int FLAG_ALLOW_CACHE_FRAGMENTATION; static final int HTTP_METHOD_GET; static final int HTTP_METHOD_POST; static final int HTTP_METHOD_HEAD; final Uri uri; final @HttpMethod int httpMethod; @Nullable final byte[] httpBody; final Map<String, String> httpRequestHeaders; final long absoluteStreamPosition; final long position; final long length; @Nullable final String key; final @Flags int flags; }
@Test public void subrange_copiesHttpRequestHeaders() { Map<String, String> httpRequestProperties = createRequestProperties(5); DataSpec dataSpec = createDataSpecWithHeaders(httpRequestProperties); DataSpec dataSpecCopy = dataSpec.subrange(2); assertThat(dataSpecCopy.httpRequestHeaders).isEqualTo(httpRequestProperties); }
@Test public void subrange_withOffsetAndLength_copiesHttpRequestHeaders() { Map<String, String> httpRequestProperties = createRequestProperties(5); DataSpec dataSpec = createDataSpecWithHeaders(httpRequestProperties); DataSpec dataSpecCopy = dataSpec.subrange(2, 2); assertThat(dataSpecCopy.httpRequestHeaders).isEqualTo(httpRequestProperties); }