73 lines
2.5 KiB
Java
73 lines
2.5 KiB
Java
package com.bumptech.glide.load;
|
|
|
|
import com.bumptech.glide.load.ImageHeaderParser;
|
|
import com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool;
|
|
import com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.nio.ByteBuffer;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class ImageHeaderParserUtils {
|
|
public static ImageHeaderParser.ImageType a(List<ImageHeaderParser> list, ByteBuffer byteBuffer) throws IOException {
|
|
if (byteBuffer == null) {
|
|
return ImageHeaderParser.ImageType.UNKNOWN;
|
|
}
|
|
int size = list.size();
|
|
for (int i = 0; i < size; i++) {
|
|
ImageHeaderParser.ImageType a = list.get(i).a(byteBuffer);
|
|
if (a != ImageHeaderParser.ImageType.UNKNOWN) {
|
|
return a;
|
|
}
|
|
}
|
|
return ImageHeaderParser.ImageType.UNKNOWN;
|
|
}
|
|
|
|
public static ImageHeaderParser.ImageType b(List<ImageHeaderParser> list, InputStream inputStream, ArrayPool arrayPool) throws IOException {
|
|
if (inputStream == null) {
|
|
return ImageHeaderParser.ImageType.UNKNOWN;
|
|
}
|
|
if (!inputStream.markSupported()) {
|
|
inputStream = new RecyclableBufferedInputStream(inputStream, arrayPool);
|
|
}
|
|
inputStream.mark(5242880);
|
|
int size = list.size();
|
|
for (int i = 0; i < size; i++) {
|
|
try {
|
|
ImageHeaderParser.ImageType a = list.get(i).a(inputStream);
|
|
if (a != ImageHeaderParser.ImageType.UNKNOWN) {
|
|
return a;
|
|
}
|
|
inputStream.reset();
|
|
} finally {
|
|
inputStream.reset();
|
|
}
|
|
}
|
|
return ImageHeaderParser.ImageType.UNKNOWN;
|
|
}
|
|
|
|
public static int a(List<ImageHeaderParser> list, InputStream inputStream, ArrayPool arrayPool) throws IOException {
|
|
if (inputStream == null) {
|
|
return -1;
|
|
}
|
|
if (!inputStream.markSupported()) {
|
|
inputStream = new RecyclableBufferedInputStream(inputStream, arrayPool);
|
|
}
|
|
inputStream.mark(5242880);
|
|
int size = list.size();
|
|
for (int i = 0; i < size; i++) {
|
|
try {
|
|
int a = list.get(i).a(inputStream, arrayPool);
|
|
if (a != -1) {
|
|
return a;
|
|
}
|
|
inputStream.reset();
|
|
} finally {
|
|
inputStream.reset();
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
}
|