public class GifAnimationMetaData extends Object implements Serializable, android.os.Parcelable
GifDrawable used to retrieve metadata of GIF only,
without having to allocate the memory for its pixels.| Modifier and Type | Field and Description |
|---|---|
static android.os.Parcelable.Creator<GifAnimationMetaData> |
CREATOR |
| Constructor and Description |
|---|
GifAnimationMetaData(android.content.res.AssetFileDescriptor afd)
Retrieves metadata from AssetFileDescriptor.
|
GifAnimationMetaData(android.content.res.AssetManager assets,
String assetName)
Retrieves metadata from asset.
|
GifAnimationMetaData(byte[] bytes)
Retrieves metadata from byte array.
|
GifAnimationMetaData(ByteBuffer buffer)
Retrieves metadata from
ByteBuffer. |
GifAnimationMetaData(android.content.ContentResolver resolver,
android.net.Uri uri)
Retrieves metadata from
Uri which is resolved using resolver. |
GifAnimationMetaData(File file)
Equivalent to GifMetadata(file.getPath())}
|
GifAnimationMetaData(FileDescriptor fd)
Retrieves metadata from FileDescriptor
|
GifAnimationMetaData(InputStream stream)
Retrieves metadata from InputStream.
|
GifAnimationMetaData(android.content.res.Resources res,
int id)
Retrieves from resource.
|
GifAnimationMetaData(String filePath)
Constructs metadata from given file path.
|
| Modifier and Type | Method and Description |
|---|---|
int |
describeContents() |
long |
getAllocationByteCount()
Like
GifDrawable.getAllocationByteCount() but does not include memory needed for backing Bitmap. |
long |
getDrawableAllocationByteCount(GifDrawable oldDrawable,
int sampleSize)
Like
getAllocationByteCount() but includes also backing Bitmap and takes sample size into account. |
int |
getDuration()
|
int |
getHeight() |
int |
getLoopCount()
|
long |
getMetadataAllocationByteCount()
|
int |
getNumberOfFrames() |
int |
getWidth() |
boolean |
isAnimated() |
String |
toString() |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public static final android.os.Parcelable.Creator<GifAnimationMetaData> CREATOR
public GifAnimationMetaData(@NonNull
android.content.res.Resources res,
@RawRes @DrawableRes
int id)
throws android.content.res.Resources.NotFoundException,
IOException
res - Resources to read fromid - resource idandroid.content.res.Resources.NotFoundException - if the given ID does not exist.IOException - when opening failedNullPointerException - if res is nullpublic GifAnimationMetaData(@NonNull
android.content.res.AssetManager assets,
@NonNull
String assetName)
throws IOException
assets - AssetManager to read fromassetName - name of the assetIOException - when opening failedNullPointerException - if assets or assetName is nullpublic GifAnimationMetaData(@NonNull
String filePath)
throws IOException
StrictMode policy if disk reads detection is enabled.filePath - path to the GIF fileIOException - when opening failedNullPointerException - if filePath is nullpublic GifAnimationMetaData(@NonNull
File file)
throws IOException
file - the GIF fileIOException - when opening failedNullPointerException - if file is nullpublic GifAnimationMetaData(@NonNull
InputStream stream)
throws IOException
stream - stream to read fromIOException - when opening failedIllegalArgumentException - if stream does not support markingNullPointerException - if stream is nullpublic GifAnimationMetaData(@NonNull
android.content.res.AssetFileDescriptor afd)
throws IOException
GifAnimationMetaData(FileDescriptor)afd - sourceNullPointerException - if afd is nullIOException - when opening failedpublic GifAnimationMetaData(@NonNull
FileDescriptor fd)
throws IOException
fd - sourceIOException - when opening failedNullPointerException - if fd is nullpublic GifAnimationMetaData(@NonNull
byte[] bytes)
throws IOException
bytes - raw GIF bytesIOException - if bytes does not contain valid GIF dataNullPointerException - if bytes are nullpublic GifAnimationMetaData(@NonNull
ByteBuffer buffer)
throws IOException
ByteBuffer. Only direct buffers are supported.
Buffer can be larger than size of the GIF data. Bytes beyond GIF terminator are not accessed.buffer - buffer containing GIF dataIOException - if buffer does not contain valid GIF data or is indirectNullPointerException - if buffer is nullpublic GifAnimationMetaData(@Nullable
android.content.ContentResolver resolver,
@NonNull
android.net.Uri uri)
throws IOException
Uri which is resolved using resolver.
ContentResolver.openAssetFileDescriptor(android.net.Uri, String)
is used to open an Uri.uri - GIF Uri, cannot be null.resolver - resolver, null is allowed for file:// scheme Uris onlyIOException - if resolution fails or destination is not a GIF.public int getWidth()
public int getHeight()
public int getNumberOfFrames()
public int getLoopCount()
public int getDuration()
public boolean isAnimated()
public long getAllocationByteCount()
GifDrawable.getAllocationByteCount() but does not include memory needed for backing Bitmap.
Bitmap in GifDrawable may be allocated at the time of creation or existing one may be reused if GifDrawableInit.with(GifDrawable)
is used.
This method assumes no subsampling (sample size = 1).GifDrawable created from the same input source getDrawableAllocationByteCount(GifDrawable, int)
can be used.Bitmap and assuming no subsampling@Beta public long getDrawableAllocationByteCount(@Nullable GifDrawable oldDrawable, int sampleSize)
getAllocationByteCount() but includes also backing Bitmap and takes sample size into account.oldDrawable - optional old drawable to be reused, pass null if there is no onesampleSize - sample size, pass 1 if not using subsamplingIllegalArgumentException - if sample size out of rangepublic long getMetadataAllocationByteCount()
public int describeContents()
describeContents in interface android.os.Parcelablepublic void writeToParcel(android.os.Parcel dest,
int flags)
writeToParcel in interface android.os.Parcelable