java.lang.Object | |
↳ | android.content.res.AssetFileDescriptor |
File descriptor of an entry in the AssetManager. This provides your own opened FileDescriptor that can be used to read the data, as well as the offset and length of that entry's data in the file.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AssetFileDescriptor.AutoCloseInputStream | An InputStream you can create on a ParcelFileDescriptor, which will
take care of calling ParcelFileDescritor.close() for you when the stream is closed. |
||||||||||
AssetFileDescriptor.AutoCloseOutputStream | An OutputStream you can create on a ParcelFileDescriptor, which will
take care of calling ParcelFileDescritor.close() for you when the stream is closed. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
long | UNKNOWN_LENGTH | Length used with AssetFileDescriptor(ParcelFileDescriptor, long, long)
and getDeclaredLength() when a length has not been declared. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.Parcelable
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CREATOR |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new AssetFileDescriptor from the given values.
| |||||||||||
Create a new AssetFileDescriptor from the given values.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Convenience for calling
getParcelFileDescriptor().close() . | |||||||||||
Create and return a new auto-close input stream for this asset.
| |||||||||||
Create and return a new auto-close output stream for this asset.
| |||||||||||
Describe the kinds of special objects contained in this Parcelable's
marshalled representation.
| |||||||||||
Return the actual number of bytes that were declared when the
AssetFileDescriptor was constructed.
| |||||||||||
Returns any additional details that can be used to interpret the
underlying file descriptor.
| |||||||||||
Returns the FileDescriptor that can be used to read the data in the
file.
| |||||||||||
Returns the total number of bytes of this asset entry's data.
| |||||||||||
The AssetFileDescriptor contains its own ParcelFileDescriptor, which
in addition to the normal FileDescriptor object also allows you to close
the descriptor when you are done with it.
| |||||||||||
Returns the byte offset where this asset entry's data starts.
| |||||||||||
Returns a string containing a concise, human-readable description of this
object.
| |||||||||||
Flatten this object in to a Parcel.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
android.os.Parcelable
| |||||||||||
From interface
java.io.Closeable
| |||||||||||
From interface
java.lang.AutoCloseable
|
Length used with AssetFileDescriptor(ParcelFileDescriptor, long, long)
and getDeclaredLength()
when a length has not been declared. This means
the data extends to the end of the file.
Create a new AssetFileDescriptor from the given values.
fd | The underlying file descriptor. |
---|---|
startOffset | The location within the file that the asset starts. This must be 0 if length is UNKNOWN_LENGTH. |
length | The number of bytes of the asset, or
UNKNOWN_LENGTH if it extends to the end of the file.
|
Create a new AssetFileDescriptor from the given values.
fd | The underlying file descriptor. |
---|---|
startOffset | The location within the file that the asset starts. This must be 0 if length is UNKNOWN_LENGTH. |
length | The number of bytes of the asset, or
UNKNOWN_LENGTH if it extends to the end of the file. |
extras | additional details that can be used to interpret the underlying file descriptor. May be null. |
Convenience for calling getParcelFileDescriptor().close()
.
IOException |
---|
Create and return a new auto-close input stream for this asset. This
will either return a full asset AssetFileDescriptor.AutoCloseInputStream
, or
an underlying ParcelFileDescriptor.AutoCloseInputStream
depending on whether the
the object represents a complete file or sub-section of a file. You
should only call this once for a particular asset.
IOException |
---|
Create and return a new auto-close output stream for this asset. This
will either return a full asset AssetFileDescriptor.AutoCloseOutputStream
, or
an underlying ParcelFileDescriptor.AutoCloseOutputStream
depending on whether the
the object represents a complete file or sub-section of a file. You
should only call this once for a particular asset.
IOException |
---|
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
Return the actual number of bytes that were declared when the
AssetFileDescriptor was constructed. Will be
UNKNOWN_LENGTH
if the length was not declared, meaning data
should be read to the end of the file.
Returns any additional details that can be used to interpret the underlying file descriptor. May be null.
Returns the FileDescriptor that can be used to read the data in the file.
Returns the total number of bytes of this asset entry's data. May be
UNKNOWN_LENGTH
if the asset extends to the end of the file.
If the AssetFileDescriptor was constructed with UNKNOWN_LENGTH
,
this will use ParcelFileDescriptor.getStatSize()
to find the total size of the file,
returning that number if found or UNKNOWN_LENGTH
if it could
not be determined.
The AssetFileDescriptor contains its own ParcelFileDescriptor, which in addition to the normal FileDescriptor object also allows you to close the descriptor when you are done with it.
Returns the byte offset where this asset entry's data starts.
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString
method
if you intend implementing your own toString
method.
Flatten this object in to a Parcel.
out | The Parcel in which the object should be written. |
---|---|
flags | Additional flags about how the object should be written.
May be 0 or PARCELABLE_WRITE_RETURN_VALUE .
|