public class GifAnimationMetaData
extends java.lang.Object
implements java.io.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,
java.lang.String assetName)
Retrieves metadata from asset.
|
GifAnimationMetaData(byte[] bytes)
Retrieves metadata from byte array.
|
GifAnimationMetaData(java.nio.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(java.io.File file)
Equivalent to GifMetadata(file.getPath())}
|
GifAnimationMetaData(java.io.FileDescriptor fd)
Retrieves metadata from FileDescriptor
|
GifAnimationMetaData(java.io.InputStream stream)
Retrieves metadata from InputStream.
|
GifAnimationMetaData(android.content.res.Resources res,
int id)
Retrieves from resource.
|
GifAnimationMetaData(java.lang.String filePath)
Constructs metadata from given file path.
|
Modifier and Type | Method and Description |
---|---|
int |
describeContents() |
int |
getDuration()
Retrieves duration of one loop of the animation.
|
int |
getHeight() |
int |
getLoopCount()
Returns loop count previously read from GIF's application extension block.
|
int |
getNumberOfFrames() |
int |
getWidth() |
boolean |
isAnimated() |
java.lang.String |
toString() |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public static final android.os.Parcelable.Creator<GifAnimationMetaData> CREATOR
public GifAnimationMetaData(android.content.res.Resources res, int id) throws android.content.res.Resources.NotFoundException, java.io.IOException
res
- Resources to read fromid
- resource idandroid.content.res.Resources.NotFoundException
- if the given ID does not exist.java.io.IOException
- when opening failedjava.lang.NullPointerException
- if res is nullpublic GifAnimationMetaData(android.content.res.AssetManager assets, java.lang.String assetName) throws java.io.IOException
assets
- AssetManager to read fromassetName
- name of the assetjava.io.IOException
- when opening failedjava.lang.NullPointerException
- if assets or assetName is nullpublic GifAnimationMetaData(java.lang.String filePath) throws java.io.IOException
StrictMode
policy if disk reads detection is enabled.filePath
- path to the GIF filejava.io.IOException
- when opening failedjava.lang.NullPointerException
- if filePath is nullpublic GifAnimationMetaData(java.io.File file) throws java.io.IOException
file
- the GIF filejava.io.IOException
- when opening failedjava.lang.NullPointerException
- if file is nullpublic GifAnimationMetaData(java.io.InputStream stream) throws java.io.IOException
stream
- stream to read fromjava.io.IOException
- when opening failedjava.lang.IllegalArgumentException
- if stream does not support markingjava.lang.NullPointerException
- if stream is nullpublic GifAnimationMetaData(android.content.res.AssetFileDescriptor afd) throws java.io.IOException
GifAnimationMetaData(FileDescriptor)
afd
- sourcejava.lang.NullPointerException
- if afd is nulljava.io.IOException
- when opening failedpublic GifAnimationMetaData(java.io.FileDescriptor fd) throws java.io.IOException
fd
- sourcejava.io.IOException
- when opening failedjava.lang.NullPointerException
- if fd is nullpublic GifAnimationMetaData(byte[] bytes) throws java.io.IOException
bytes
- raw GIF bytesjava.io.IOException
- if bytes does not contain valid GIF datajava.lang.NullPointerException
- if bytes are nullpublic GifAnimationMetaData(java.nio.ByteBuffer buffer) throws java.io.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 datajava.io.IOException
- if buffer does not contain valid GIF datajava.lang.IllegalArgumentException
- if buffer is indirectjava.lang.NullPointerException
- if buffer is nullpublic GifAnimationMetaData(android.content.ContentResolver resolver, android.net.Uri uri) throws java.io.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, cannot be null.java.io.IOException
- if resolution fails or destination is not a GIF.public int getWidth()
public int getHeight()
public int getNumberOfFrames()
public int getLoopCount()
public int getDuration()
getNumberOfFrames()
to determine if there is one or more frames.public boolean isAnimated()
public java.lang.String toString()
toString
in class java.lang.Object
public int describeContents()
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, int flags)
writeToParcel
in interface android.os.Parcelable