alexandroid/decompiled/jadx/sources/androidx/exifinterface/media/ExifInterfaceUtils.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

130 lines
3.9 KiB
Java

package androidx.exifinterface.media;
import android.media.MediaDataSource;
import android.media.MediaMetadataRetriever;
import android.system.ErrnoException;
import android.system.Os;
import android.util.Log;
import androidx.annotation.RequiresApi;
import java.io.Closeable;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import okio.Buffer$$ExternalSyntheticBUOutline0;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
/* loaded from: classes14.dex */
class ExifInterfaceUtils {
private static final String TAG = "ExifInterfaceUtils";
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
@RequiresApi(23)
public static class Api23Impl {
private Api23Impl() {
}
public static void setDataSource(MediaMetadataRetriever mediaMetadataRetriever, MediaDataSource mediaDataSource) {
mediaMetadataRetriever.setDataSource(mediaDataSource);
}
}
private ExifInterfaceUtils() {
}
public static String byteArrayToHexString(byte[] bArr) {
StringBuilder sb = new StringBuilder(bArr.length * 2);
for (byte b : bArr) {
sb.append(String.format("%02x", Byte.valueOf(b)));
}
return sb.toString();
}
public static void closeFileDescriptor(FileDescriptor fileDescriptor) {
try {
Os.close(fileDescriptor);
} catch (ErrnoException e) {
Log.e(TAG, "Error closing fd.", e);
}
}
public static void closeQuietly(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (RuntimeException e) {
throw e;
} catch (Exception unused) {
}
}
}
public static long[] convertToLongArray(Object obj) {
if (!(obj instanceof int[])) {
if (obj instanceof long[]) {
return (long[]) obj;
}
return null;
}
int[] iArr = (int[]) obj;
long[] jArr = new long[iArr.length];
for (int i = 0; i < iArr.length; i++) {
jArr[i] = iArr[i];
}
return jArr;
}
public static void copy(InputStream inputStream, OutputStream outputStream, int i) throws IOException {
byte[] bArr = new byte[8192];
while (i > 0) {
int min = Math.min(i, 8192);
int read = inputStream.read(bArr, 0, min);
if (read != min) {
Buffer$$ExternalSyntheticBUOutline0.m$2("Failed to copy the given amount of bytes from the inputstream to the output stream.");
return;
} else {
i -= read;
outputStream.write(bArr, 0, read);
}
}
}
public static long parseSubSeconds(String str) {
try {
int min = Math.min(str.length(), 3);
long parseLong = Long.parseLong(str.substring(0, min));
while (min < 3) {
parseLong *= 10;
min++;
}
return parseLong;
} catch (NumberFormatException unused) {
return 0L;
}
}
public static boolean startsWith(byte[] bArr, byte[] bArr2) {
if (bArr == null || bArr2 == null || bArr.length < bArr2.length) {
return false;
}
for (int i = 0; i < bArr2.length; i++) {
if (bArr[i] != bArr2[i]) {
return false;
}
}
return true;
}
public static int copy(InputStream inputStream, OutputStream outputStream) throws IOException {
byte[] bArr = new byte[8192];
int i = 0;
while (true) {
int read = inputStream.read(bArr);
if (read == -1) {
return i;
}
i += read;
outputStream.write(bArr, 0, read);
}
}
}