Class ExifInterfaceImageHeaderParser
- java.lang.Object
-
- com.bumptech.glide.load.resource.bitmap.ExifInterfaceImageHeaderParser
-
- All Implemented Interfaces:
ImageHeaderParser
@RequiresApi(27) public final class ExifInterfaceImageHeaderParser extends java.lang.Object implements ImageHeaderParser
UsesExifInterfaceto parse orientation data.ExifInterface supports the HEIF format on OMR1+. Glide's
DefaultImageHeaderParserdoesn't currently support HEIF. In the future we should reconcile these two classes, but for now this is a simple way to ensure that HEIF files are oriented correctly on platforms where they're supported.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.bumptech.glide.load.ImageHeaderParser
ImageHeaderParser.ImageType
-
-
Field Summary
-
Fields inherited from interface com.bumptech.glide.load.ImageHeaderParser
UNKNOWN_ORIENTATION
-
-
Constructor Summary
Constructors Constructor Description ExifInterfaceImageHeaderParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetOrientation(java.io.InputStream is, ArrayPool byteArrayPool)Parse the orientation from the image header.intgetOrientation(java.nio.ByteBuffer byteBuffer, ArrayPool byteArrayPool)ImageHeaderParser.ImageTypegetType(java.io.InputStream is)ImageHeaderParser.ImageTypegetType(java.nio.ByteBuffer byteBuffer)
-
-
-
Method Detail
-
getType
@NonNull public ImageHeaderParser.ImageType getType(@NonNull java.io.InputStream is)
- Specified by:
getTypein interfaceImageHeaderParser
-
getType
@NonNull public ImageHeaderParser.ImageType getType(@NonNull java.nio.ByteBuffer byteBuffer)
- Specified by:
getTypein interfaceImageHeaderParser
-
getOrientation
public int getOrientation(@NonNull java.io.InputStream is, @NonNull ArrayPool byteArrayPool) throws java.io.IOExceptionDescription copied from interface:ImageHeaderParserParse the orientation from the image header. If it doesn't handle this image type (or this is not an image) it will return a default value rather than throwing an exception.- Specified by:
getOrientationin interfaceImageHeaderParser- Returns:
- The exif orientation if present or -1 if the header couldn't be parsed or doesn't contain an orientation
- Throws:
java.io.IOException
-
getOrientation
public int getOrientation(@NonNull java.nio.ByteBuffer byteBuffer, @NonNull ArrayPool byteArrayPool) throws java.io.IOException- Specified by:
getOrientationin interfaceImageHeaderParser- Throws:
java.io.IOException
-
-