com.google.android.exoplayer2.util.Util.toUpperInvariant()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(206)

本文整理了Java中com.google.android.exoplayer2.util.Util.toUpperInvariant()方法的一些代码示例,展示了Util.toUpperInvariant()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.toUpperInvariant()方法的具体详情如下:
包路径:com.google.android.exoplayer2.util.Util
类名称:Util
方法名:toUpperInvariant

Util.toUpperInvariant介绍

[英]Converts text to upper case using Locale#US.
[中]使用Locale#US将文本转换为大写。

代码示例

代码示例来源:origin: google/ExoPlayer

  1. /**
  2. * Sets the initial bitrate estimates to the default values of the specified country. The
  3. * initial estimates are used when a bandwidth estimate is unavailable.
  4. *
  5. * @param countryCode The ISO 3166-1 alpha-2 country code of the country whose default bitrate
  6. * estimates should be used.
  7. * @return This builder.
  8. */
  9. public Builder setInitialBitrateEstimate(String countryCode) {
  10. initialBitrateEstimates =
  11. getInitialBitrateEstimatesForCountry(Util.toUpperInvariant(countryCode));
  12. return this;
  13. }

代码示例来源:origin: google/ExoPlayer

  1. /**
  2. * Returns the upper-case ISO 3166-1 alpha-2 country code of the current registered operator's MCC
  3. * (Mobile Country Code), or the country code of the default Locale if not available.
  4. *
  5. * @param context A context to access the telephony service. If null, only the Locale can be used.
  6. * @return The upper-case ISO 3166-1 alpha-2 country code, or an empty String if unavailable.
  7. */
  8. public static String getCountryCode(@Nullable Context context) {
  9. if (context != null) {
  10. TelephonyManager telephonyManager =
  11. (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
  12. if (telephonyManager != null) {
  13. String countryCode = telephonyManager.getNetworkCountryIso();
  14. if (!TextUtils.isEmpty(countryCode)) {
  15. return toUpperInvariant(countryCode);
  16. }
  17. }
  18. }
  19. return toUpperInvariant(Locale.getDefault().getCountry());
  20. }

代码示例来源:origin: google/ExoPlayer

  1. if (objectTypeString.length() >= 2) {
  2. try {
  3. String objectTypeHexString = Util.toUpperInvariant(objectTypeString.substring(0, 2));
  4. int objectTypeInt = Integer.parseInt(objectTypeHexString, 16);
  5. mimeType = getMimeTypeFromMp4ObjectType(objectTypeInt);

代码示例来源:origin: google/ExoPlayer

  1. assertThat(Util.toUpperInvariant(segment.encryptionIV)).isEqualTo("A7A");
  2. assertThat(segment.byterangeLength).isEqualTo(51740);
  3. assertThat(segment.byterangeOffset).isEqualTo(2147586650L);
  4. assertThat(Util.toUpperInvariant(segment.encryptionIV)).isEqualTo("A7B");
  5. assertThat(segment.byterangeLength).isEqualTo(C.LENGTH_UNSET);
  6. assertThat(segment.byterangeOffset).isEqualTo(0);

相关文章