Automated Code Change
PiperOrigin-RevId: 660491742
This commit is contained in:
parent
3763e5bc1d
commit
2202397758
@ -27,9 +27,9 @@ import androidx.media3.common.PlaybackException;
|
||||
import androidx.media3.common.util.Assertions;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.common.util.Util;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.io.IOException;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/** A {@link DataSource} for reading data URLs, as defined by RFC 2397. */
|
||||
@UnstableApi
|
||||
@ -68,7 +68,7 @@ public final class DataSchemeDataSource extends BaseDataSource {
|
||||
}
|
||||
} else {
|
||||
// TODO: Add support for other charsets.
|
||||
data = Util.getUtf8Bytes(URLDecoder.decode(dataString, Charsets.US_ASCII.name()));
|
||||
data = Util.getUtf8Bytes(URLDecoder.decode(dataString, StandardCharsets.US_ASCII.name()));
|
||||
}
|
||||
if (dataSpec.position > data.length) {
|
||||
data = null;
|
||||
|
@ -17,8 +17,8 @@ package androidx.media3.datasource.cache;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@ -83,7 +83,7 @@ public final class DefaultContentMetadata implements ContentMetadata {
|
||||
public final String get(String key, @Nullable String defaultValue) {
|
||||
@Nullable byte[] bytes = metadata.get(key);
|
||||
if (bytes != null) {
|
||||
return new String(bytes, Charsets.UTF_8);
|
||||
return new String(bytes, StandardCharsets.UTF_8);
|
||||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
@ -165,7 +165,7 @@ public final class DefaultContentMetadata implements ContentMetadata {
|
||||
if (value instanceof Long) {
|
||||
return ByteBuffer.allocate(8).putLong((Long) value).array();
|
||||
} else if (value instanceof String) {
|
||||
return ((String) value).getBytes(Charsets.UTF_8);
|
||||
return ((String) value).getBytes(StandardCharsets.UTF_8);
|
||||
} else if (value instanceof byte[]) {
|
||||
return (byte[]) value;
|
||||
} else {
|
||||
|
@ -23,7 +23,7 @@ import static org.junit.Assert.assertThrows;
|
||||
import androidx.media3.datasource.DataSpec;
|
||||
import androidx.media3.datasource.HttpDataSource;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import okhttp3.Headers;
|
||||
@ -118,7 +118,7 @@ public class OkHttpDataSourceTest {
|
||||
() -> okHttpDataSource.open(dataSpec));
|
||||
|
||||
assertThat(exception.responseCode).isEqualTo(404);
|
||||
assertThat(exception.responseBody).isEqualTo("failure msg".getBytes(Charsets.UTF_8));
|
||||
assertThat(exception.responseBody).isEqualTo("failure msg".getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -42,9 +42,9 @@ import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.common.util.Util;
|
||||
import androidx.media3.exoplayer.analytics.PlayerId;
|
||||
import androidx.media3.extractor.mp4.PsshAtomUtil;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -541,7 +541,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
|
||||
return data;
|
||||
}
|
||||
int recordLength = byteArray.readLittleEndianShort();
|
||||
String xml = byteArray.readString(recordLength, Charsets.UTF_16LE);
|
||||
String xml = byteArray.readString(recordLength, StandardCharsets.UTF_16LE);
|
||||
if (xml.contains("<LA_URL>")) {
|
||||
// LA_URL already present. Do nothing.
|
||||
return data;
|
||||
@ -562,7 +562,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
|
||||
newData.putShort((short) objectRecordCount);
|
||||
newData.putShort((short) recordType);
|
||||
newData.putShort((short) (xmlWithMockLaUrl.length() * UTF_16_BYTES_PER_CHARACTER));
|
||||
newData.put(xmlWithMockLaUrl.getBytes(Charsets.UTF_16LE));
|
||||
newData.put(xmlWithMockLaUrl.getBytes(StandardCharsets.UTF_16LE));
|
||||
return newData.array();
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@ import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
@ -56,7 +57,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
Format format = new Format.Builder().setSampleMimeType(mimeType).build();
|
||||
this.externalLoader = externalLoader;
|
||||
tracks = new TrackGroupArray(new TrackGroup(format));
|
||||
sampleData = uri.toString().getBytes(Charsets.UTF_8);
|
||||
sampleData = uri.toString().getBytes(StandardCharsets.UTF_8);
|
||||
loadingFinished = new AtomicBoolean();
|
||||
loadingThrowable = new AtomicReference<>();
|
||||
}
|
||||
|
@ -78,7 +78,6 @@ import androidx.media3.exoplayer.upstream.LoaderErrorThrower;
|
||||
import androidx.media3.exoplayer.upstream.ParsingLoadable;
|
||||
import androidx.media3.exoplayer.util.SntpClient;
|
||||
import androidx.media3.extractor.text.SubtitleParser;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.math.LongMath;
|
||||
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
||||
import java.io.BufferedReader;
|
||||
@ -86,6 +85,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.math.RoundingMode;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
@ -1460,7 +1460,7 @@ public final class DashMediaSource extends BaseMediaSource {
|
||||
@Override
|
||||
public Long parse(Uri uri, InputStream inputStream) throws IOException {
|
||||
String firstLine =
|
||||
new BufferedReader(new InputStreamReader(inputStream, Charsets.UTF_8)).readLine();
|
||||
new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)).readLine();
|
||||
try {
|
||||
Matcher matcher = TIMESTAMP_WITH_TIMEZONE_PATTERN.matcher(firstLine);
|
||||
if (!matcher.matches()) {
|
||||
|
@ -47,12 +47,12 @@ import androidx.media3.exoplayer.upstream.ParsingLoadable;
|
||||
import androidx.media3.extractor.metadata.emsg.EventMessage;
|
||||
import androidx.media3.extractor.mp4.PsshAtomUtil;
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@ -1214,7 +1214,7 @@ public class DashManifestParser extends DefaultHandler
|
||||
throws XmlPullParserException, IOException {
|
||||
scratchOutputStream.reset();
|
||||
XmlSerializer xmlSerializer = Xml.newSerializer();
|
||||
xmlSerializer.setOutput(scratchOutputStream, Charsets.UTF_8.name());
|
||||
xmlSerializer.setOutput(scratchOutputStream, StandardCharsets.UTF_8.name());
|
||||
// Start reading everything between <Event> and </Event>, and serialize them into an Xml
|
||||
// byte array.
|
||||
xpp.nextToken();
|
||||
|
@ -32,10 +32,10 @@ import androidx.media3.extractor.metadata.emsg.EventMessage;
|
||||
import androidx.media3.test.utils.TestUtil;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.junit.Test;
|
||||
@ -149,7 +149,7 @@ public class DashManifestParserTest {
|
||||
assertThat(eventStream1.events.length).isEqualTo(1);
|
||||
EventMessage expectedEvent1 =
|
||||
new EventMessage(
|
||||
"urn:uuid:XYZY", "call", 10000, 0, "+ 1 800 10101010".getBytes(Charsets.UTF_8));
|
||||
"urn:uuid:XYZY", "call", 10000, 0, "+ 1 800 10101010".getBytes(StandardCharsets.UTF_8));
|
||||
assertThat(eventStream1.events[0]).isEqualTo(expectedEvent1);
|
||||
assertThat(eventStream1.presentationTimesUs[0]).isEqualTo(0);
|
||||
|
||||
@ -157,7 +157,8 @@ public class DashManifestParserTest {
|
||||
EventStream eventStream2 = period.eventStreams.get(1);
|
||||
assertThat(eventStream2.events.length).isEqualTo(1);
|
||||
EventMessage expectedEvent2 =
|
||||
new EventMessage("urn:uuid:with-pto", "pto-4s", 10000, 0, "pt=1s".getBytes(Charsets.UTF_8));
|
||||
new EventMessage(
|
||||
"urn:uuid:with-pto", "pto-4s", 10000, 0, "pt=1s".getBytes(StandardCharsets.UTF_8));
|
||||
assertThat(eventStream2.events[0]).isEqualTo(expectedEvent2);
|
||||
assertThat(eventStream2.presentationTimesUs[0]).isEqualTo(1000000);
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
package androidx.media3.exoplayer.dash.offline;
|
||||
|
||||
import android.net.Uri;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/** Data for DASH downloading tests. */
|
||||
/* package */ interface DashDownloadTestData {
|
||||
@ -86,7 +86,7 @@ import com.google.common.base.Charsets;
|
||||
+ " </AdaptationSet>\n"
|
||||
+ " </Period>\n"
|
||||
+ "</MPD>")
|
||||
.getBytes(Charsets.UTF_8);
|
||||
.getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
byte[] TEST_MPD_NO_INDEX =
|
||||
("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
@ -99,5 +99,5 @@ import com.google.common.base.Charsets;
|
||||
+ " </AdaptationSet>\n"
|
||||
+ " </Period>\n"
|
||||
+ "</MPD>")
|
||||
.getBytes(Charsets.UTF_8);
|
||||
.getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package androidx.media3.exoplayer.hls.offline;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/** Data for HLS downloading tests. */
|
||||
/* package */ interface HlsDownloadTestData {
|
||||
@ -48,7 +48,7 @@ import com.google.common.base.Charsets;
|
||||
+ "\n"
|
||||
+ "#EXT-X-STREAM-INF:BANDWIDTH=41457,CODECS=\"mp4a.40.2\"\n"
|
||||
+ MEDIA_PLAYLIST_0_URI)
|
||||
.getBytes(Charsets.UTF_8);
|
||||
.getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
byte[] MEDIA_PLAYLIST_DATA =
|
||||
("#EXTM3U\n"
|
||||
@ -63,7 +63,7 @@ import com.google.common.base.Charsets;
|
||||
+ "#EXTINF:9.97667,\n"
|
||||
+ "fileSequence2.ts\n"
|
||||
+ "#EXT-X-ENDLIST")
|
||||
.getBytes(Charsets.UTF_8);
|
||||
.getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
String ENC_MEDIA_PLAYLIST_URI = "enc_index.m3u8";
|
||||
|
||||
@ -82,5 +82,5 @@ import com.google.common.base.Charsets;
|
||||
+ "#EXTINF:9.97667,\n"
|
||||
+ "fileSequence2.ts\n"
|
||||
+ "#EXT-X-ENDLIST")
|
||||
.getBytes(Charsets.UTF_8);
|
||||
.getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
|
@ -27,9 +27,9 @@ import androidx.media3.common.ParserException;
|
||||
import androidx.media3.exoplayer.hls.HlsTrackMetadataEntry;
|
||||
import androidx.media3.exoplayer.hls.playlist.HlsMultivariantPlaylist.Variant;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -482,7 +482,7 @@ public class HlsMultivariantPlaylistParserTest {
|
||||
String uri, String playlistString) throws IOException {
|
||||
Uri playlistUri = Uri.parse(uri);
|
||||
ByteArrayInputStream inputStream =
|
||||
new ByteArrayInputStream(playlistString.getBytes(Charsets.UTF_8));
|
||||
new ByteArrayInputStream(playlistString.getBytes(StandardCharsets.UTF_8));
|
||||
return (HlsMultivariantPlaylist) new HlsPlaylistParser().parse(playlistUri, inputStream);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ import androidx.media3.exoplayer.upstream.Loader;
|
||||
import androidx.media3.exoplayer.upstream.Loader.LoadErrorAction;
|
||||
import androidx.media3.exoplayer.upstream.Loader.Loadable;
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.primitives.Ints;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -46,6 +45,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.net.Socket;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@ -57,7 +57,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
/* package */ final class RtspMessageChannel implements Closeable {
|
||||
|
||||
/** RTSP uses UTF-8 (RFC2326 Section 1.1). */
|
||||
public static final Charset CHARSET = Charsets.UTF_8;
|
||||
public static final Charset CHARSET = StandardCharsets.UTF_8;
|
||||
|
||||
private static final String TAG = "RtspMessageChannel";
|
||||
|
||||
|
@ -21,8 +21,8 @@ import androidx.media3.common.util.ParsableBitArray;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.extractor.metadata.MetadataInputBuffer;
|
||||
import androidx.media3.extractor.metadata.SimpleMetadataDecoder;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@ -108,7 +108,7 @@ public final class AppInfoTableDecoder extends SimpleMetadataDecoder {
|
||||
// See section 5.3.6.2.
|
||||
while (sectionData.getBytePosition() < positionOfNextDescriptor) {
|
||||
int urlBaseLength = sectionData.readBits(8);
|
||||
urlBase = sectionData.readBytesAsString(urlBaseLength, Charsets.US_ASCII);
|
||||
urlBase = sectionData.readBytesAsString(urlBaseLength, StandardCharsets.US_ASCII);
|
||||
|
||||
int extensionCount = sectionData.readBits(8);
|
||||
for (int urlExtensionIndex = 0;
|
||||
@ -121,7 +121,7 @@ public final class AppInfoTableDecoder extends SimpleMetadataDecoder {
|
||||
}
|
||||
} else if (descriptorTag == DESCRIPTOR_SIMPLE_APPLICATION_LOCATION) {
|
||||
// See section 5.3.7.
|
||||
urlExtension = sectionData.readBytesAsString(descriptorLength, Charsets.US_ASCII);
|
||||
urlExtension = sectionData.readBytesAsString(descriptorLength, StandardCharsets.US_ASCII);
|
||||
}
|
||||
|
||||
sectionData.setPosition(positionOfNextDescriptor * 8);
|
||||
|
@ -25,7 +25,7 @@ import androidx.media3.common.Metadata;
|
||||
import androidx.media3.common.MimeTypes;
|
||||
import androidx.media3.common.util.ParsableByteArray;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
|
||||
/** A picture parsed from a Vorbis Comment or a FLAC picture block. */
|
||||
@ -161,7 +161,8 @@ public final class PictureFrame implements Metadata.Entry {
|
||||
int pictureType = pictureBlock.readInt();
|
||||
int mimeTypeLength = pictureBlock.readInt();
|
||||
String mimeType =
|
||||
MimeTypes.normalizeMimeType(pictureBlock.readString(mimeTypeLength, Charsets.US_ASCII));
|
||||
MimeTypes.normalizeMimeType(
|
||||
pictureBlock.readString(mimeTypeLength, StandardCharsets.US_ASCII));
|
||||
int descriptionLength = pictureBlock.readInt();
|
||||
String description = pictureBlock.readString(descriptionLength);
|
||||
int width = pictureBlock.readInt();
|
||||
|
@ -21,10 +21,10 @@ import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.extractor.metadata.MetadataInputBuffer;
|
||||
import androidx.media3.extractor.metadata.SimpleMetadataDecoder;
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.CharacterCodingException;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -40,8 +40,8 @@ public final class IcyDecoder extends SimpleMetadataDecoder {
|
||||
private final CharsetDecoder iso88591Decoder;
|
||||
|
||||
public IcyDecoder() {
|
||||
utf8Decoder = Charsets.UTF_8.newDecoder();
|
||||
iso88591Decoder = Charsets.ISO_8859_1.newDecoder();
|
||||
utf8Decoder = StandardCharsets.UTF_8.newDecoder();
|
||||
iso88591Decoder = StandardCharsets.ISO_8859_1.newDecoder();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,10 +27,10 @@ import androidx.media3.common.util.Util;
|
||||
import androidx.media3.extractor.metadata.MetadataInputBuffer;
|
||||
import androidx.media3.extractor.metadata.SimpleMetadataDecoder;
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -525,7 +525,7 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
||||
|
||||
int urlStartIndex = descriptionEndIndex + delimiterLength(encoding);
|
||||
int urlEndIndex = indexOfZeroByte(data, urlStartIndex);
|
||||
String url = decodeStringIfValid(data, urlStartIndex, urlEndIndex, Charsets.ISO_8859_1);
|
||||
String url = decodeStringIfValid(data, urlStartIndex, urlEndIndex, StandardCharsets.ISO_8859_1);
|
||||
|
||||
return new UrlLinkFrame("WXXX", description, url);
|
||||
}
|
||||
@ -536,7 +536,7 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
||||
id3Data.readBytes(data, 0, frameSize);
|
||||
|
||||
int urlEndIndex = indexOfZeroByte(data, 0);
|
||||
String url = new String(data, 0, urlEndIndex, Charsets.ISO_8859_1);
|
||||
String url = new String(data, 0, urlEndIndex, StandardCharsets.ISO_8859_1);
|
||||
|
||||
return new UrlLinkFrame(id, null, url);
|
||||
}
|
||||
@ -546,7 +546,7 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
||||
id3Data.readBytes(data, 0, frameSize);
|
||||
|
||||
int ownerEndIndex = indexOfZeroByte(data, 0);
|
||||
String owner = new String(data, 0, ownerEndIndex, Charsets.ISO_8859_1);
|
||||
String owner = new String(data, 0, ownerEndIndex, StandardCharsets.ISO_8859_1);
|
||||
|
||||
int privateDataStartIndex = ownerEndIndex + 1;
|
||||
byte[] privateData = copyOfRangeIfValid(data, privateDataStartIndex, data.length);
|
||||
@ -563,7 +563,8 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
||||
|
||||
int mimeTypeEndIndex = indexOfZeroByte(data, 0);
|
||||
String mimeType =
|
||||
MimeTypes.normalizeMimeType(new String(data, 0, mimeTypeEndIndex, Charsets.ISO_8859_1));
|
||||
MimeTypes.normalizeMimeType(
|
||||
new String(data, 0, mimeTypeEndIndex, StandardCharsets.ISO_8859_1));
|
||||
|
||||
int filenameStartIndex = mimeTypeEndIndex + 1;
|
||||
int filenameEndIndex = indexOfTerminator(data, filenameStartIndex, encoding);
|
||||
@ -592,13 +593,14 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
||||
int mimeTypeEndIndex;
|
||||
if (majorVersion == 2) {
|
||||
mimeTypeEndIndex = 2;
|
||||
mimeType = "image/" + Ascii.toLowerCase(new String(data, 0, 3, Charsets.ISO_8859_1));
|
||||
mimeType = "image/" + Ascii.toLowerCase(new String(data, 0, 3, StandardCharsets.ISO_8859_1));
|
||||
if ("image/jpg".equals(mimeType)) {
|
||||
mimeType = "image/jpeg";
|
||||
}
|
||||
} else {
|
||||
mimeTypeEndIndex = indexOfZeroByte(data, 0);
|
||||
mimeType = Ascii.toLowerCase(new String(data, 0, mimeTypeEndIndex, Charsets.ISO_8859_1));
|
||||
mimeType =
|
||||
Ascii.toLowerCase(new String(data, 0, mimeTypeEndIndex, StandardCharsets.ISO_8859_1));
|
||||
if (mimeType.indexOf('/') == -1) {
|
||||
mimeType = "image/" + mimeType;
|
||||
}
|
||||
@ -659,7 +661,7 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
||||
id3Data.getData(),
|
||||
framePosition,
|
||||
chapterIdEndIndex - framePosition,
|
||||
Charsets.ISO_8859_1);
|
||||
StandardCharsets.ISO_8859_1);
|
||||
id3Data.setPosition(chapterIdEndIndex + 1);
|
||||
|
||||
int startTime = id3Data.readInt();
|
||||
@ -702,7 +704,7 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
||||
id3Data.getData(),
|
||||
framePosition,
|
||||
elementIdEndIndex - framePosition,
|
||||
Charsets.ISO_8859_1);
|
||||
StandardCharsets.ISO_8859_1);
|
||||
id3Data.setPosition(elementIdEndIndex + 1);
|
||||
|
||||
int ctocFlags = id3Data.readUnsignedByte();
|
||||
@ -715,7 +717,8 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
||||
int startIndex = id3Data.getPosition();
|
||||
int endIndex = indexOfZeroByte(id3Data.getData(), startIndex);
|
||||
children[i] =
|
||||
new String(id3Data.getData(), startIndex, endIndex - startIndex, Charsets.ISO_8859_1);
|
||||
new String(
|
||||
id3Data.getData(), startIndex, endIndex - startIndex, StandardCharsets.ISO_8859_1);
|
||||
id3Data.setPosition(endIndex + 1);
|
||||
}
|
||||
|
||||
@ -798,14 +801,14 @@ public final class Id3Decoder extends SimpleMetadataDecoder {
|
||||
private static Charset getCharset(int encodingByte) {
|
||||
switch (encodingByte) {
|
||||
case ID3_TEXT_ENCODING_UTF_16:
|
||||
return Charsets.UTF_16;
|
||||
return StandardCharsets.UTF_16;
|
||||
case ID3_TEXT_ENCODING_UTF_16BE:
|
||||
return Charsets.UTF_16BE;
|
||||
return StandardCharsets.UTF_16BE;
|
||||
case ID3_TEXT_ENCODING_UTF_8:
|
||||
return Charsets.UTF_8;
|
||||
return StandardCharsets.UTF_8;
|
||||
case ID3_TEXT_ENCODING_ISO_8859_1:
|
||||
default:
|
||||
return Charsets.ISO_8859_1;
|
||||
return StandardCharsets.ISO_8859_1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,8 @@ import androidx.media3.common.util.Util;
|
||||
import androidx.media3.extractor.text.CuesWithTiming;
|
||||
import androidx.media3.extractor.text.SubtitleParser;
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@ -119,7 +119,7 @@ public final class SsaParser implements SubtitleParser {
|
||||
Assertions.checkArgument(formatLine.startsWith(FORMAT_LINE_PREFIX));
|
||||
dialogueFormatFromInitializationData =
|
||||
Assertions.checkNotNull(SsaDialogueFormat.fromFormatLine(formatLine));
|
||||
parseHeader(new ParsableByteArray(initializationData.get(1)), Charsets.UTF_8);
|
||||
parseHeader(new ParsableByteArray(initializationData.get(1)), StandardCharsets.UTF_8);
|
||||
} else {
|
||||
haveInitializationData = false;
|
||||
dialogueFormatFromInitializationData = null;
|
||||
@ -189,7 +189,7 @@ public final class SsaParser implements SubtitleParser {
|
||||
*/
|
||||
private Charset detectUtfCharset(ParsableByteArray data) {
|
||||
@Nullable Charset charset = data.readUtfCharsetFromBom();
|
||||
return charset != null ? charset : Charsets.UTF_8;
|
||||
return charset != null ? charset : StandardCharsets.UTF_8;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,9 +33,9 @@ import androidx.media3.common.util.ParsableByteArray;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.extractor.text.CuesWithTiming;
|
||||
import androidx.media3.extractor.text.SubtitleParser;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
@ -193,7 +193,7 @@ public final class SubripParser implements SubtitleParser {
|
||||
*/
|
||||
private Charset detectUtfCharset(ParsableByteArray data) {
|
||||
@Nullable Charset charset = data.readUtfCharsetFromBom();
|
||||
return charset != null ? charset : Charsets.UTF_8;
|
||||
return charset != null ? charset : StandardCharsets.UTF_8;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,9 +39,9 @@ import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.common.util.Util;
|
||||
import androidx.media3.extractor.text.CuesWithTiming;
|
||||
import androidx.media3.extractor.text.SubtitleParser;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -204,7 +204,7 @@ public final class Tx3gParser implements SubtitleParser {
|
||||
@Nullable Charset charset = parsableByteArray.readUtfCharsetFromBom();
|
||||
int bomSize = parsableByteArray.getPosition() - textStartPosition;
|
||||
return parsableByteArray.readString(
|
||||
textLength - bomSize, charset != null ? charset : Charsets.UTF_8);
|
||||
textLength - bomSize, charset != null ? charset : StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private void applyStyleRecord(
|
||||
|
@ -25,7 +25,7 @@ import androidx.media3.common.util.Assertions;
|
||||
import androidx.media3.common.util.Util;
|
||||
import androidx.media3.extractor.metadata.MetadataInputBuffer;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@ -513,7 +513,7 @@ public final class Id3DecoderTest {
|
||||
for (FrameSpec frame : frames) {
|
||||
byte[] frameData = frame.frameData;
|
||||
String frameId = frame.frameId;
|
||||
byte[] frameIdBytes = frameId.getBytes(Charsets.UTF_8);
|
||||
byte[] frameIdBytes = frameId.getBytes(StandardCharsets.UTF_8);
|
||||
Assertions.checkState(frameIdBytes.length == 4);
|
||||
|
||||
// Fill in the frame header.
|
||||
|
@ -32,12 +32,12 @@ import androidx.media3.extractor.text.SubtitleInputBuffer;
|
||||
import androidx.media3.extractor.text.SubtitleOutputBuffer;
|
||||
import androidx.media3.test.utils.TestUtil;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.primitives.Bytes;
|
||||
import com.google.common.primitives.UnsignedBytes;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@ -72,7 +72,7 @@ public class Cea708DecoderTest {
|
||||
Bytes.concat(
|
||||
windowDefinition,
|
||||
setCurrentWindow,
|
||||
"test subtitle".getBytes(Charsets.UTF_8)))));
|
||||
"test subtitle".getBytes(StandardCharsets.UTF_8)))));
|
||||
|
||||
Subtitle firstSubtitle = decodeSampleAndCopyResult(cea708Decoder, subtitleData);
|
||||
|
||||
@ -102,7 +102,7 @@ public class Cea708DecoderTest {
|
||||
Bytes.concat(
|
||||
windowDefinition,
|
||||
setCurrentWindow,
|
||||
"row1\r\nrow2\r\nrow3\r\nrow4".getBytes(Charsets.UTF_8)))));
|
||||
"row1\r\nrow2\r\nrow3\r\nrow4".getBytes(StandardCharsets.UTF_8)))));
|
||||
|
||||
Subtitle result = decodeSampleAndCopyResult(cea708Decoder, subtitleData);
|
||||
|
||||
@ -143,9 +143,9 @@ public class Cea708DecoderTest {
|
||||
Bytes.concat(
|
||||
windowDefinition,
|
||||
setCurrentWindow,
|
||||
"line1".getBytes(Charsets.UTF_8),
|
||||
"line1".getBytes(StandardCharsets.UTF_8),
|
||||
setPenLocation,
|
||||
"line2".getBytes(Charsets.UTF_8)))));
|
||||
"line2".getBytes(StandardCharsets.UTF_8)))));
|
||||
|
||||
Subtitle firstSubtitle = decodeSampleAndCopyResult(cea708Decoder, subtitleData);
|
||||
|
||||
@ -186,10 +186,10 @@ public class Cea708DecoderTest {
|
||||
Bytes.concat(
|
||||
windowDefinition,
|
||||
setCurrentWindow,
|
||||
"line1".getBytes(Charsets.UTF_8),
|
||||
"line1".getBytes(StandardCharsets.UTF_8),
|
||||
newLine,
|
||||
setPenLocation,
|
||||
"line2".getBytes(Charsets.UTF_8)))));
|
||||
"line2".getBytes(StandardCharsets.UTF_8)))));
|
||||
|
||||
Subtitle firstSubtitle = decodeSampleAndCopyResult(cea708Decoder, subtitleData);
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
*/
|
||||
package androidx.media3.muxer;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
/** Utilities for dealing with MP4 boxes. */
|
||||
@ -28,7 +28,7 @@ import java.util.List;
|
||||
|
||||
/** Wraps content into a box, prefixing it with a length and a box type. */
|
||||
public static ByteBuffer wrapIntoBox(String boxType, ByteBuffer contents) {
|
||||
byte[] typeByteArray = boxType.getBytes(Charsets.UTF_8);
|
||||
byte[] typeByteArray = boxType.getBytes(StandardCharsets.UTF_8);
|
||||
return wrapIntoBox(typeByteArray, contents);
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ import java.util.List;
|
||||
|
||||
ByteBuffer result = ByteBuffer.allocate(totalSize);
|
||||
result.putInt(totalSize);
|
||||
result.put(boxType.getBytes(Charsets.UTF_8), 0, BOX_TYPE_BYTES);
|
||||
result.put(boxType.getBytes(StandardCharsets.UTF_8), 0, BOX_TYPE_BYTES);
|
||||
|
||||
for (int i = 0; i < boxes.size(); i++) {
|
||||
result.put(boxes.get(i));
|
||||
|
@ -32,7 +32,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.media3.common.text.Cue;
|
||||
import androidx.media3.common.util.Assertions;
|
||||
import androidx.media3.common.util.Util;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@ -329,7 +329,7 @@ import java.util.Map;
|
||||
html.insert(0, htmlHead.toString());
|
||||
|
||||
webView.loadData(
|
||||
Base64.encodeToString(html.toString().getBytes(Charsets.UTF_8), Base64.NO_PADDING),
|
||||
Base64.encodeToString(html.toString().getBytes(StandardCharsets.UTF_8), Base64.NO_PADDING),
|
||||
"text/html",
|
||||
"base64");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user